Are IEEE floats valid key types for std::map and std::set?
问题 Background The requirement for a comparator on the key type of an associative container (for example std::map) is that it imposes a strict weak order on the elements of the key type. For a given comparator comp(x, y) we define equiv(x, y) = !comp(x, y) && !comp(y, x) . The requirements for comp(x, y) being a strict weak order are Irreflexibility ( !comp(x, x) for all x ) Transitivity of the ordering (if comp(a, b) and comp(b, c) then comp(a, c) ). Transitivity of equivalence (if equiv(a, b)