set<int, less_equal<int> > s;
s.insert(10);
s.insert(10):
(!(10 <= 10) && !(10 <= 10)) get false. the set concludes that 10 and 10 are not equivalent, hence not the same, and it thus goes about inserting 10 into the container alongside 10. Technically, this action yields undefined behavior.
multiset<int, less_equal<int> > s;
s.insert(10);
s.insert(10);
do an equal_range on it. we’ll get back a pair of iterators that define a range containing both copies.
equal_range dosen’t identify a range of equal values(10 == 10), it identifies a range of equivalent values(!(10 <= 10) && !(10 <= 10)); In this example , s’s comparison function says that 10 and 10 are not equivalent, so there is no way that both can be in the range identified by equal_range.