![]() |
Home | Libraries | People | FAQ | More |
Compare a string with the string.
template<std::size_tM> constexpr int compare(basic_static_string::size_typepos1,basic_static_string::size_typecount1, constbasic_static_string< M, CharT, Traits >& s) const;
Let sub be substr(pos1, count1)
and comp be traits_type::compare(sub.data(), s.data(), std::min(sub.size(), s.size()).
If comp !=
0, then the result is comp. Otherwise, the result is 0 if sub.size() == s.size(),
-1
if sub.size() < s.size(), and 1
otherwise.
Linear.
Strong guarantee.
The result of lexicographically comparing sub
and s.
|
Type |
Description |
|---|---|
|
|
The size of the string to compare with. |
|
Name |
Description |
|---|---|
|
|
The index at which to begin the substring. |
|
|
The size of the substring. |
|
|
The string to compare. |
|
Type |
Thrown On |
|---|---|
|
|
|