Date: 2018-10-07 Author: David Stone (davidmstone@google.com, david@doublewise.net) Audience: Library Evolution Working Group (LEWG)
We currently have several facilities to compare things (mostly strings). We should unify on "the one true way". For reference, the currently existing functionality relevant to this paper (other than existing comparison operators) is:
char_traits::eq
(returns bool
)char_traits::eq_int_type
(returns bool
)char_traits::lt
(returns bool
)char_traits::compare
(returns int
)basic_string::compare
(returns int
)basic_string_view::compare
(returns int
)sub_match::compare
(returns int
)istreambuf_iterator::equal
(returns bool
)filesystem::path::compare
(returns int
)filesystem::equivalent
(returns bool
, provides the weak equality of whether two paths resolve to the same file)Note that for char_traits
, we also have a "character traits" 'concept' with the same requirements as the concrete char_traits
type.
char_traits::cmp
, which returns std::strong_ordering
for all built-in character types.cmp
that returns a comparison category orlt
and compare
(as they do now).cmp
.lt
and compare
.char_traits::lt
and char_traits::compare
.eq
and eq_int_type
, depending on the outcome of P1190: I did not order this.basic_string::compare
basic_string_view::compare
, sub_match::compare
, and filesystem::path::compare
in favor of operator<=>
.istreambuf_iterator::equal
in favor of operator==
.filesystem::equivalent
(operating on filesystem::path
objects) in favor of an overload of std::weak_equality
?