In order for (c++ stl) sort to work correctly, the comparison object must satisfy a http://en.wikipedia.org/wiki/Strict_weak_ordering
>= does not satisfy this and so the sort will not work correctly. The requirements are (taken straight from the wikipedia page) A strict weak ordering has the following properties. For all *x* and *y* in *S*, - For all *x*, it is not the case that *x* < *x* (irreflexivity<http://en.wikipedia.org/wiki/Irreflexive_relation> ). - For all *x* ≠ *y*, if *x* < *y* then it is not the case that *y* < *x* (asymmetric <http://en.wikipedia.org/wiki/Asymmetric_relation>). - For all *x*, *y*, and *z*, if *x* < *y* and *y* < *z* then *x* < *z* ( transitivity <http://en.wikipedia.org/wiki/Transitive_relation>). - For all *x*, *y*, and *z*, if *x* is incomparable with *y*, and *y* is incomparable with *z*, then *x* is incomparable with *z* (transitivity of equivalence). As for all x, x>= x, >= isn't suitable. -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
