std::basic_string_view<CharT,Traits>::compare
From cppreference.com
constexpr int compare( basic_string_view v ) const noexcept;
|
(1) | (since C++17) |
constexpr int compare( size_type pos1, size_type count1,
basic_string_view v ) const;
|
(2) | (since C++17) |
constexpr int compare( size_type pos1, size_type count1, basic_string_view v,
size_type pos2, size_type count2 ) const;
|
(3) | (since C++17) |
constexpr int compare( const CharT* s ) const;
|
(4) | (since C++17) |
constexpr int compare( size_type pos1, size_type count1,
const CharT* s ) const;
|
(5) | (since C++17) |
constexpr int compare( size_type pos1, size_type count1,
const CharT* s, size_type count2 ) const;
|
(6) | (since C++17) |
Compares two character sequences.
1) The length
rlen of the sequences to compare is the smaller of size() and v.size(). The function compares the two views by calling traits::compare(data(), v.data(), rlen), and returns a value according to the following table:| Condition | Result | Return value | |
|---|---|---|---|
Traits::compare(data(), v.data(), rlen) < 0
|
this is less than v
|
< 0
| |
Traits::compare(data(), v.data(), rlen) == 0
|
size() < v.size()
|
this is less than v
|
< 0
|
size() == v.size()
|
this is equal to v
|
||