Compare
is a set of requirements that some std library functions expect from user provided types.
Given type T
that is a binary predicate, let
comp
, an object of typeT
equiv(a, b)
defined as!comp(a, b) && !comp(b, a)
comp(a, b)
establishes a strict weak ordering i.e. both of comp(a, b)
and comp(b, a)
cannot be true. comp
defines a strict total order over equivalence classes defined by equiv
. Also, comp(a, a)
is always false
.