@@ -55,11 +55,16 @@ 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 );
60- if (itl == lhs.end ())
61- return false ;
62- else if (itl->second <= itr->second )
58+ CColorAmount::const_iterator itl (lhs.begin ());
59+ CColorAmount::const_iterator itr (rhs.begin ());
60+ for (; itr != rhs.end () ; itl++, itr++) {
61+ while (itl.first != itr.first ) {
62+ if (itl == lhs.end ())
63+ return false ;
64+ else
65+ itl++;
66+ }
67+ if (itl->second <= itr->second )
6368 return false ;
6469 }
6570
@@ -69,11 +74,16 @@ class CColorAmount : public colorAmount_t
6974 bool operator >=(const CColorAmount& rhs) const
7075 {
7176 CColorAmount lhs = (*this );
72- for (CColorAmount::const_iterator itr (rhs.begin ()); itr != rhs.end (); itr++) {
73- CColorAmount::const_iterator itl = lhs.find (itr->first );
74- if (itl == lhs.end ())
75- return false ;
76- else if (itl->second < itr->second )
77+ CColorAmount::const_iterator itl (lhs.begin ());
78+ CColorAmount::const_iterator itr (rhs.begin ());
79+ for (; itr != rhs.end () ; itl++, itr++) {
80+ while (itl.first != itr.first ) {
81+ if (itl == lhs.end ())
82+ return false ;
83+ else
84+ itl++;
85+ }
86+ if (itl->second < itr->second )
7787 return false ;
7888 }
7989
@@ -83,30 +93,13 @@ class CColorAmount : public colorAmount_t
8393 bool operator <(const CColorAmount& rhs) const
8494 {
8595 CColorAmount lhs = (*this );
86- for (CColorAmount::const_iterator itl (lhs.begin ()); itl != lhs.end (); itl++) {
87- CColorAmount::const_iterator itr = rhs.find (itl->first );
88- if (itr == rhs.end ())
89- return false ;
90- else if (itl->second >= itr->second )
91- return false ;
92- }
93-
94- return true ;
96+ return !(lhs >= rhs);
9597 }
9698
9799 bool operator <=(const CColorAmount& rhs) const
98100 {
99101 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 );
103- if (itr == rhs.end ())
104- return false ;
105- else if (itl->second > itr->second )
106- return false ;
107- }
108-
109- return true ;
102+ return !(lhs > rhs);
110103 }
111104
112105 bool operator ==(const CColorAmount& rhs) const
0 commit comments