Using the || operator makes the operator< invalid, because the following is true:
("foo", "bar") < ("bar", "foo") < is true for second string
("bar", "foo") < ("foo", "bar") < is true for first string
We fix this by fully comparing one string, then trying the other one.
This commit is contained in:
@@ -45,7 +45,9 @@ public:
|
||||
const RString &GetPath() const { return sPath; }
|
||||
bool operator<( const CourseID &other ) const
|
||||
{
|
||||
return sPath < other.sPath || sFullTitle < other.sFullTitle;
|
||||
if (sPath != other.sPath)
|
||||
return sPath < other.sPath;
|
||||
return sFullTitle < other.sFullTitle;
|
||||
}
|
||||
|
||||
XNode* CreateNode() const;
|
||||
|
||||
Reference in New Issue
Block a user