...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.
constexpr int compare( const_pointer s) const;
Let len
be traits_type::length(s)
and comp
be traits_type::compare(data(), s, std::min(size(), len)
.
If comp !=
0
, then the result is comp
. Otherwise, the result is 0
if size() == len
, -1
if size() < len
, and 1
otherwise.
Linear.
The result of lexicographically comparing s
and the string.
Name |
Description |
---|---|
|
The string to compare. |