Since C++14 we have std::less<void>
that is transparent and more usefull in most cases, so is there reasons why, for example, std::set
still has std::less<Key>
as a predicate by default, not an std::less<void>
except historical reasons.
Useful cases: std::set<std::string>::find
with std::string_view
, etc.
It would break current working code to do so. Imagine I have
If
std::set
was changed to usestd::less<void>
then this code would no longer compile sincemy_type
does not have anoperator <
.