Macaulay2 Engine
Loading...
Searching...
No Matches

◆ compare()

template<class E, bool L>
int ExponentList< E, L >::compare ( ConstExponents a,
ConstExponents b )
inlinestatic

Definition at line 145 of file ExponentList.hpp.

146 {
147 Exponent alen = length(a++) - 1;
148 Exponent blen = length(b++) - 1;
149 // TODO: try using std::lexicographical_compare?
150 for (size_t i = 0; i < std::min(alen, blen); i++)
151 {
152 Exponent c = *a++ - *b++;
153 if (c == 0) continue;
154 return (c > 0 ? GT : LT);
155 }
156 if (alen == blen) return EQ;
157 return (alen > blen ? GT : LT);
158 }
static const Exponent length(ConstExponents m)