From http://stdcxx.apache.org/doc/stdlibref/less-equal.html:
You can pass aless_equal
object to any algorithm that requires a binary function. For example, thesort()
algorithm can accept a binary function as an alternate comparison object to sort a sequence.less_equal
would be used in that algorithm in the following manner:vector<int> vec1; sort(vec1.begin(), vec1.end(), less_equal<int>());
Now I am confused, is the documentation above correct ?
i1 <= i2
andi2 <= i1
which may block progress of thesort
algorithm. – Uptotheminutea < b
orb < a
depends on wherea
andb
are in the sequence. And since they may be relocated as the algorithm progresses, its possible that the same two values are compared again, only the other way around. – Erratic