operator==,!=,<,<=,>,>=,<=>(std::basic_string)
| ヘッダ <string> で定義
|
||
| 2つの basic_string オブジェクトの比較 |
||
| (1) | ||
| template< class CharT, class Traits, class Alloc > bool operator==( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14未満) | |
| template< class CharT, class Traits, class Alloc > bool operator==( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14以上) (C++20未満) |
|
| template< class CharT, class Traits, class Alloc > constexpr bool |
(C++20以上) | |
| (2) | ||
| template< class CharT, class Traits, class Alloc > bool operator!=( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14未満) | |
| template< class CharT, class Traits, class Alloc > bool operator!=( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14以上) (C++20未満) |
|
| (3) | ||
| template< class CharT, class Traits, class Alloc > bool operator<( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14未満) | |
| template< class CharT, class Traits, class Alloc > bool operator<( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14以上) (C++20未満) |
|
| (4) | ||
| template< class CharT, class Traits, class Alloc > bool operator>=( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14未満) | |
| template< class CharT, class Traits, class Alloc > bool operator>=( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14以上) (C++20未満) |
|
| (5) | ||
| template< class CharT, class Traits, class Alloc > bool operator>( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14未満) | |
| template< class CharT, class Traits, class Alloc > bool operator>( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14以上) (C++20未満) |
|
| (6) | ||
| template< class CharT, class Traits, class Alloc > bool operator>=( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14未満) | |
| template< class CharT, class Traits, class Alloc > bool operator>=( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++14以上) (C++20未満) |
|
| template< class CharT, class Traits, class Alloc > constexpr /*comp-cat*/ |
(7) | (C++20以上) |
basic_string オブジェクトと T のNULL終端配列の比較 |
||
| (8) | ||
| template< class CharT, class Traits, class Alloc > bool operator==( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++20未満) | |
| template< class CharT, class Traits, class Alloc > constexpr bool operator==( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++20以上) | |
| template< class CharT, class Traits, class Alloc > bool operator==( const CharT* lhs, |
(C++20未満) | |
| (9) | ||
| template< class CharT, class Traits, class Alloc > bool operator!=( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++20未満) | |
| template< class CharT, class Traits, class Alloc > bool operator!=( const CharT* lhs, |
(C++20未満) | |
| (10) | ||
| template< class CharT, class Traits, class Alloc > bool operator<( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++20未満) | |
| template< class CharT, class Traits, class Alloc > bool operator<( const CharT* lhs, |
(C++20未満) | |
| (11) | ||
| template< class CharT, class Traits, class Alloc > bool operator<=( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++20未満) | |
| template< class CharT, class Traits, class Alloc > bool operator<=( const CharT* lhs, |
(C++20未満) | |
| (12) | ||
| template< class CharT, class Traits, class Alloc > bool operator>( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++20未満) | |
| template< class CharT, class Traits, class Alloc > bool operator>( const CharT* lhs, |
(C++20未満) | |
| (13) | ||
| template< class CharT, class Traits, class Alloc > bool operator>=( const std::basic_string<CharT,Traits,Alloc>& lhs, |
(C++20未満) | |
| template< class CharT, class Traits, class Alloc > bool operator>=( const CharT* lhs, |
(C++20未満) | |
| template< class CharT, class Traits, class Alloc > constexpr /*comp-cat*/ |
(14) | (C++20以上) |
文字列の内容を別の文字列または CharT のヌル終端配列と比較します。
すべての比較は compare() メンバ関数を通して行われます (compare() 自身は Traits::compare() によって定義されます)。
-
lhsとrhsのサイズが等しく、lhs内のそれぞれの文字がrhs内の同じ位置の文字と等しければ、2つの文字列は等しくなります。
- 順序比較は辞書的に行われます。 比較は std::lexicographical_compare または std::lexicographical_compare_three_way (C++20以上) と同等な関数によって行われます。
|
三方比較演算子の戻り値の型 (/*comp-cat*/) は、存在すれば Traits::comparison_category、そうでなければ std::weak_ordering です。 |
(C++20以上) |
basic_string オブジェクトを比較します。basic_string オブジェクトと CharT のヌル終端配列を比較します。目次 |
[編集] 引数
| lhs, rhs | - | 内容を比較する文字列 |
[編集] 戻り値
[編集] 計算量
文字列のサイズに比例。
[編集] ノート
|
少なくとも1つの引数の型が std::string、 std::wstring、 std::u8string、 std::u16string または std::u32string である場合、 |
(C++20以上) |