std::experimental::basic_string_view<CharT,Traits>::compare (3) - Linux Manuals
std::experimental::basic_string_view<CharT,Traits>::compare: std::experimental::basic_string_view<CharT,Traits>::compare
Command to display std::experimental::basic_string_view<CharT,Traits>::compare
manual in Linux: $ man 3 std::experimental::basic_string_view<CharT,Traits>::compare
NAME
std::experimental::basic_string_view<CharT,Traits>::compare - std::experimental::basic_string_view<CharT,Traits>::compare
Synopsis
constexpr int compare(basic_string_view v) const noexcept; (1) (library fundamentals TS)
constexpr int compare(size_type pos1, size_type count1, (2) (library fundamentals TS)
basic_string_view v) const
constexpr int compare(size_type pos1, size_type count1, basic_string_view v, (3) (library fundamentals TS)
size_type pos2, size_type count2) const;
constexpr int compare(const CharT* s) const; (4) (library fundamentals TS)
constexpr int compare(size_type pos1, size_type count1, (5) (library fundamentals TS)
const CharT* s) const;
constexpr int compare(size_type pos1, size_type count1, (6) (library fundamentals TS)
const CharT* s, size_type count2) const;
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
size() < v.size() this is less than v <0
Traits::compare(data(), v.data(), rlen) == 0 size() == v.size() this is equal to v 0
size() > v.size() this is greater than v >0
Traits::compare(data(), v.data(), rlen) > 0 this is greater than v >0
2) Equivalent to substr(pos1, count1).compare(v).
3) Equivalent to substr(pos1, count1).compare(v.substr(pos2, count2)).
4) Equivalent to compare(basic_string_view(s)).
5) Equivalent to substr(pos1, count1).compare(basic_string_view(s)).
6) Equivalent to substr(pos1, count1).compare(basic_string_view(s, count2)).
Parameters
v - view to compare
s - pointer to the character string to compare to
count1 - number of characters of this view to compare
pos1 - position of the first character in this view to compare
count2 - number of characters of the given view to compare
pos2 - position of the first character of the given view to compare
Return value
negative value if this view is less than the other character sequence, zero if the both character sequences are equal, positive value if this view is greater than the other character sequence.
Complexity
1) Linear in the number of characters compared.
See also
operator==
operator!= lexicographically compares two views
operator< (function template)
operator>
operator<=
operator>=
Pages related to std::experimental::basic_string_view<CharT,Traits>::compare
- std::experimental::basic_string_view<CharT,Traits>::copy (3) - std::experimental::basic_string_view<CharT,Traits>::copy
- std::experimental::basic_string_view<CharT,Traits>::at (3) - std::experimental::basic_string_view<CharT,Traits>::at
- std::experimental::basic_string_view<CharT,Traits>::back (3) - std::experimental::basic_string_view<CharT,Traits>::back
- std::experimental::basic_string_view<CharT,Traits>::basic_string_view (3) - std::experimental::basic_string_view<CharT,Traits>::basic_string_view
- std::experimental::basic_string_view<CharT,Traits>::begin, (3) - std::experimental::basic_string_view<CharT,Traits>::begin,
- std::experimental::basic_string_view<CharT,Traits>::begin,std::experimental::basic_string_view<CharT,Traits>::cbegin (3) - std::experimental::basic_string_view<CharT,Traits>::begin,std::experimental::basic_string_view<CharT,Traits>::cbegin
- std::experimental::basic_string_view<CharT,Traits>::data (3) - std::experimental::basic_string_view<CharT,Traits>::data
- std::experimental::basic_string_view<CharT,Traits>::empty (3) - std::experimental::basic_string_view<CharT,Traits>::empty
- std::experimental::basic_string_view<CharT,Traits>::end, (3) - std::experimental::basic_string_view<CharT,Traits>::end,
- std::experimental::basic_string_view<CharT,Traits>::end,std::experimental::basic_string_view<CharT,Traits>::cend (3) - std::experimental::basic_string_view<CharT,Traits>::end,std::experimental::basic_string_view<CharT,Traits>::cend
- std::experimental::basic_string_view<CharT,Traits>::find (3) - std::experimental::basic_string_view<CharT,Traits>::find
- std::experimental::basic_string_view<CharT,Traits>::find_first_not_of (3) - std::experimental::basic_string_view<CharT,Traits>::find_first_not_of
- std::experimental::basic_string_view<CharT,Traits>::find_first_of (3) - std::experimental::basic_string_view<CharT,Traits>::find_first_of
- std::experimental::basic_string_view<CharT,Traits>::find_last_not_of (3) - std::experimental::basic_string_view<CharT,Traits>::find_last_not_of
- std::experimental::basic_string_view<CharT,Traits>::find_last_of (3) - std::experimental::basic_string_view<CharT,Traits>::find_last_of
- std::experimental::basic_string_view<CharT,Traits>::front (3) - std::experimental::basic_string_view<CharT,Traits>::front
- std::experimental::basic_string_view<CharT,Traits>::max_size (3) - std::experimental::basic_string_view<CharT,Traits>::max_size
- std::experimental::basic_string_view<CharT,Traits>::npos (3) - std::experimental::basic_string_view<CharT,Traits>::npos
- std::experimental::basic_string_view<CharT,Traits>::operator= (3) - std::experimental::basic_string_view<CharT,Traits>::operator=
- std::experimental::basic_string_view<CharT,Traits>::operator[] (3) - std::experimental::basic_string_view<CharT,Traits>::operator[]
- std::experimental::basic_string_view<CharT,Traits>::rbegin, (3) - std::experimental::basic_string_view<CharT,Traits>::rbegin,
- std::experimental::basic_string_view<CharT,Traits>::rbegin,std::experimental::basic_string_view<CharT,Traits>::crbegin (3) - std::experimental::basic_string_view<CharT,Traits>::rbegin,std::experimental::basic_string_view<CharT,Traits>::crbegin
- std::experimental::basic_string_view<CharT,Traits>::remove_prefix (3) - std::experimental::basic_string_view<CharT,Traits>::remove_prefix
- std::experimental::basic_string_view<CharT,Traits>::remove_suffix (3) - std::experimental::basic_string_view<CharT,Traits>::remove_suffix
- std::experimental::basic_string_view<CharT,Traits>::rend, (3) - std::experimental::basic_string_view<CharT,Traits>::rend,
- std::experimental::basic_string_view<CharT,Traits>::rend,std::experimental::basic_string_view<CharT,Traits>::crend (3) - std::experimental::basic_string_view<CharT,Traits>::rend,std::experimental::basic_string_view<CharT,Traits>::crend
- std::experimental::basic_string_view<CharT,Traits>::rfind (3) - std::experimental::basic_string_view<CharT,Traits>::rfind
- std::experimental::basic_string_view<CharT,Traits>::size, (3) - std::experimental::basic_string_view<CharT,Traits>::size,
- std::experimental::basic_string_view<CharT,Traits>::size,std::experimental::basic_string_view<CharT,Traits>::length (3) - std::experimental::basic_string_view<CharT,Traits>::size,std::experimental::basic_string_view<CharT,Traits>::length
- std::experimental::basic_string_view<CharT,Traits>::substr (3) - std::experimental::basic_string_view<CharT,Traits>::substr
- std::experimental::basic_string_view<CharT,Traits>::swap (3) - std::experimental::basic_string_view<CharT,Traits>::swap
- std::experimental::basic_string_view<CharT,Traits>::to_string, (3) - std::experimental::basic_string_view<CharT,Traits>::to_string,
- std::experimental::basic_string_view<CharT,Traits>::to_string,std::experimental::basic_string_view<CharT,Traits>::operatorbasic_string (3) - std::experimental::basic_string_view<CharT,Traits>::to_string,std::experimental::basic_string_view<CharT,Traits>::operatorbasic_string
- std::experimental::basic_string_view (3) - std::experimental::basic_string_view
- std::experimental::bad_any_cast (3) - std::experimental::bad_any_cast