◐ Shell
clean mode source ↗

operator==,!=,<,<=,>,>=,<=>(std::basic_string) - cppreference.com

比较两个 basic_string 对象

template< class CharT, class Traits, class Alloc >
bool operator==( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const std::basic_string<CharT,Traits,Alloc>& rhs );
(1) (C++11 起为 noexcept)
(C++20 起为 constexpr)
template< class CharT, class Traits, class Alloc >
bool operator!=( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const std::basic_string<CharT,Traits,Alloc>& rhs );
(2) (C++20 前)
(C++11 起为 noexcept)
template< class CharT, class Traits, class Alloc >
bool operator<( const std::basic_string<CharT,Traits,Alloc>& lhs,
                const std::basic_string<CharT,Traits,Alloc>& rhs );
(3) (C++20 前)
(C++11 起为 noexcept)
template< class CharT, class Traits, class Alloc >
bool operator<=( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const std::basic_string<CharT,Traits,Alloc>& rhs );
(4) (C++20 前)
(C++11 起为 noexcept)
template< class CharT, class Traits, class Alloc >
bool operator>( const std::basic_string<CharT,Traits,Alloc>& lhs,
                const std::basic_string<CharT,Traits,Alloc>& rhs );
(5) (C++20 前)
(C++11 起为 noexcept)
template< class CharT, class Traits, class Alloc >
bool operator>=( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const std::basic_string<CharT,Traits,Alloc>& rhs );
(6) (C++20 前)
(C++11 起为 noexcept)
template< class CharT, class Traits, class Alloc >
constexpr /*comp-cat*/
    operator<=>( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const std::basic_string<CharT,Traits,Alloc>& rhs ) noexcept;
(7) (C++20 起)

比较 basic_string 对象与 T 的空终止数组

template< class CharT, class Traits, class Alloc >
bool operator==( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const CharT* rhs );
(8) (C++20 起为 constexpr)
template< class CharT, class Traits, class Alloc >
bool operator==( const CharT* lhs,
                 const std::basic_string<CharT,Traits,Alloc>& rhs );
(9) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator!=( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const CharT* rhs );
(10) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator!=( const CharT* lhs,
                 const std::basic_string<CharT,Traits,Alloc>& rhs );
(11) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator<( const std::basic_string<CharT,Traits,Alloc>& lhs,
                const CharT* rhs );
(12) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator<( const CharT* lhs,
                const std::basic_string<CharT,Traits,Alloc>& rhs );
(13) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator<=( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const CharT* rhs );
(14) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator<=( const CharT* lhs,
                 const std::basic_string<CharT,Traits,Alloc>& rhs );
(15) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator>( const std::basic_string<CharT,Traits,Alloc>& lhs,
                const CharT* rhs );
(16) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator>( const CharT* lhs,
                const std::basic_string<CharT,Traits,Alloc>& rhs );
(17) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator>=( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const CharT* rhs );
(18) (C++20 前)
template< class CharT, class Traits, class Alloc >
bool operator>=( const CharT* lhs,
                 const std::basic_string<CharT,Traits,Alloc>& rhs );
(19) (C++20 前)
template< class CharT, class Traits, class Alloc >
constexpr /*comp-cat*/
    operator<=>( const std::basic_string<CharT,Traits,Alloc>& lhs,
                 const CharT* rhs );
(20) (C++20 起)