fix StepsID::operator<

beware: invalid < operations (where a<b and b<a can both be true)
lead to crashes with std::map on glibc
This commit is contained in:
Glenn Maynard
2004-04-26 00:08:51 +00:00
parent 9707e6bb0c
commit 8f7e6894dc
2 changed files with 11 additions and 4 deletions
+10
View File
@@ -205,3 +205,13 @@ bool StepsID::IsValid() const
return st != STEPS_TYPE_INVALID && dc != DIFFICULTY_INVALID;
}
bool StepsID::operator<( const StepsID &rhs ) const
{
#define COMP(a) if(a<rhs.a) return true; if(a>rhs.a) return false;
COMP(st);
COMP(dc);
COMP(sDescription);
COMP(uHash);
#undef COMP
return false;
}
+1 -4
View File
@@ -44,10 +44,7 @@ public:
void Unset() { FromSteps(NULL); }
void FromSteps( const Steps *p );
Steps *ToSteps( const Song *p, bool bAllowNull ) const;
bool operator<( const StepsID &other ) const
{
return st < other.st || dc < other.dc || sDescription < other.sDescription || uHash < other.uHash;
}
bool operator<( const StepsID &rhs ) const;
XNode* CreateNode() const;
void LoadFromNode( const XNode* pNode );