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:
John Bauer
2006-10-19 23:17:42 +00:00
parent c4286ee6f3
commit 1ea284e910
+3 -1
View File
@@ -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;