operator==,!=,<,<=,>,>=(std::basic_string)
提供: cppreference.com
< cpp | string | basic string
| 2つの basic_string オブジェクトの比較 |
||
| template< class CharT, class Traits, class Alloc > bool operator==( const basic_string<CharT,Traits,Alloc>& lhs, |
(1) | |
| template< class CharT, class Traits, class Alloc > bool operator!=( const basic_string<CharT,Traits,Alloc>& lhs, |
(2) | |
| template< class CharT, class Traits, class Alloc > bool operator<( const basic_string<CharT,Traits,Alloc>& lhs, |
(3) | |
| template< class CharT, class Traits, class Alloc > bool operator<=( const basic_string<CharT,Traits,Alloc>& lhs, |
(4) | |
| template< class CharT, class Traits, class Alloc > bool operator>( const basic_string<CharT,Traits,Alloc>& lhs, |
(5) | |
| template< class CharT, class Traits, class Alloc > bool operator>=( const basic_string<CharT,Traits,Alloc>& lhs, |
(6) | |
basic_string オブジェクトと T のNULL終端配列の比較 |
||
| template< class CharT, class Traits, class Alloc > bool operator==( const CharT* lhs, const basic_string<CharT,Traits,Alloc>& rhs ); |
(7) | |
| template< class CharT, class Traits, class Alloc > bool operator==( const basic_string<CharT,Traits,Alloc>& lhs, const CharT* rhs ); |
(7) | |
| template< class CharT, class Traits, class Alloc > bool operator!=( const CharT* lhs, const basic_string<CharT,Traits,Alloc>& rhs ); |
(8) | |
| template< class CharT, class Traits, class Alloc > bool operator!=( const basic_string<CharT,Traits,Alloc>& lhs, const CharT* rhs ); |
(8) | |
| template< class CharT, class Traits, class Alloc > bool operator<( const CharT* lhs, const basic_string<CharT,Traits,Alloc>& rhs ); |
(9) | |
| template< class CharT, class Traits, class Alloc > bool operator<( const basic_string<CharT,Traits,Alloc>& lhs, const CharT* rhs ); |
(9) | |
| template< class CharT, class Traits, class Alloc > bool operator<=( const CharT* lhs, const basic_string<CharT,Traits,Alloc>& rhs ); |
(10) | |
| template< class CharT, class Traits, class Alloc > bool operator<=( const basic_string<CharT,Traits,Alloc>& lhs, const CharT* rhs ); |
(10) | |
| template< class CharT, class Traits, class Alloc > bool operator>( const CharT* lhs, const basic_string<CharT,Traits,Alloc>& rhs ); |
(11) | |
| template< class CharT, class Traits, class Alloc > bool operator>( const basic_string<CharT,Traits,Alloc>& lhs, const CharT* rhs ); |
(11) | |
| template< class CharT, class Traits, class Alloc > bool operator>=( const CharT* lhs, const basic_string<CharT,Traits,Alloc>& rhs ); |
(12) | |
| template< class CharT, class Traits, class Alloc > bool operator>=( const basic_string<CharT,Traits,Alloc>& lhs, const CharT* rhs ); |
(12) | |
文字列の内容を別の文字列または CharT のNULL終端配列と比較します。
すべての比較は compare() メンバ関数を通して行われます (compare() 自身は Traits::compare() によって定義されます)。
-
lhsとrhsのサイズが等しく、lhs内のそれぞれの文字がrhs内の同じ位置の文字と等しければ、2つの文字列は等しくなります。
- 順序比較は辞書的に行われます。 比較は std::lexicographical_compare と同等な関数によって行われます。
1-6) 2つの
basic_string オブジェクトを比較します。7-12)
basic_string オブジェクトと CharT のNULL終端配列を比較します。目次 |
[編集] 引数
| lhs, rhs | - | 内容を比較する文字列 |
[編集] 戻り値
対応する比較が成立すれば true、そうでなければ false。
[編集] 例外
1-6)
| (なし) | (C++14以前) |
| noexcept 指定: noexcept |
(C++14およびそれ以降) |
7-12) (なし)
[編集] 計算量
文字列のサイズに比例。