@@ -55,11 +55,15 @@ class CColorAmount : public colorAmount_t
5555 bool operator >(const CColorAmount& rhs) const
5656 {
5757 CColorAmount lhs = (*this );
58- for (CColorAmount::const_iterator itr (rhs.begin ()); itr != rhs.end (); itr++) {
59- CColorAmount::const_iterator itl = lhs.find (itr->first );
58+ CColorAmount::const_iterator itl (lhs.begin ());
59+ CColorAmount::const_iterator itr (rhs.begin ());
60+ if (itl == lhs.end ())
61+ return false ;
62+ for (; itr != rhs.end (); itr++) {
63+ for (; itl != lhs.end () && itl->first != itr->first ; itl++);
6064 if (itl == lhs.end ())
6165 return false ;
62- else if (itl->second <= itr->second )
66+ if (itl->second <= itr->second )
6367 return false ;
6468 }
6569
@@ -69,11 +73,13 @@ class CColorAmount : public colorAmount_t
6973 bool operator >=(const CColorAmount& rhs) const
7074 {
7175 CColorAmount lhs = (*this );
72- for (CColorAmount::const_iterator itr (rhs.begin ()); itr != rhs.end (); itr++) {
73- CColorAmount::const_iterator itl = lhs.find (itr->first );
76+ CColorAmount::const_iterator itl (lhs.begin ());
77+ CColorAmount::const_iterator itr (rhs.begin ());
78+ for (; itr != rhs.end (); itr++) {
79+ for (; itl != lhs.end () && itl->first != itr->first ; itl++);
7480 if (itl == lhs.end ())
7581 return false ;
76- else if (itl->second < itr->second )
82+ if (itl->second < itr->second )
7783 return false ;
7884 }
7985
@@ -83,11 +89,15 @@ class CColorAmount : public colorAmount_t
8389 bool operator <(const CColorAmount& rhs) const
8490 {
8591 CColorAmount lhs = (*this );
86- for (CColorAmount::const_iterator itl (lhs.begin ()); itl != lhs.end (); itl++) {
87- CColorAmount::const_iterator itr = rhs.find (itl->first );
92+ CColorAmount::const_iterator itl (lhs.begin ());
93+ CColorAmount::const_iterator itr (rhs.begin ());
94+ if (itr == rhs.end ())
95+ return false ;
96+ for (; itl != lhs.end (); itl++) {
97+ for (; itr != rhs.end () && itl->first != itr->first ; itr++);
8898 if (itr == rhs.end ())
8999 return false ;
90- else if (itl->second >= itr->second )
100+ if (itl->second >= itr->second )
91101 return false ;
92102 }
93103
@@ -97,12 +107,13 @@ class CColorAmount : public colorAmount_t
97107 bool operator <=(const CColorAmount& rhs) const
98108 {
99109 CColorAmount lhs = (*this );
100-
101- for (CColorAmount::const_iterator itl (lhs.begin ()); itl != lhs.end (); itl++) {
102- CColorAmount::const_iterator itr = rhs.find (itl->first );
110+ CColorAmount::const_iterator itl (lhs.begin ());
111+ CColorAmount::const_iterator itr (rhs.begin ());
112+ for (; itl != lhs.end (); itl++) {
113+ for (; itr != rhs.end () && itl->first != itr->first ; itr++);
103114 if (itr == rhs.end ())
104115 return false ;
105- else if (itl->second > itr->second )
116+ if (itl->second > itr->second )
106117 return false ;
107118 }
108119
0 commit comments