...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Compare a string with the string.
int
compare(
string_view
sv) const noexcept;
Let comp
be std::char_traits<char>::compare(data(), sv.data(), std::min(size(), sv.size())
. If comp
!= 0
,
then the result is comp
.
Otherwise, the result is 0
if size()
== sv.size()
, -1
if size() < sv.size()
, and 1
otherwise.
Linear.
The result of lexicographically comparing the characters of sv
and the string.
Name |
Description |
---|---|
|
The |