Namespaces
Variants

operator==,!=,<,<=,>,>=,<=> (std::sub_match)

From cppreference.net
Regular expressions library
Classes
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
std::sub_match
Member functions
Non-member functions
operator== operator!= operator<< operator<= operator> operator>= operator<=>
(until C++20) (until C++20) (until C++20) (until C++20) (until C++20) (C++20)
(注:指定されたテキスト部分には翻訳対象の自然言語テキストが含まれていないため、HTML構造はそのまま保持されています)
定義済みヘッダー <regex>
直接比較
template < class BidirIt >

bool operator == ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(1) (C++11以降)
template < class BidirIt >

bool operator ! = ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(2) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator < ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(3) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator <= ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(4) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator > ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(5) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator >= ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(6) (C++11以降)
(C++20まで)
template < class BidirIt >

auto operator <=> ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(7) (C++20以降)
std::basic_string との比較
template < class BidirIt, class Traits, class Alloc >

bool operator == ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(8) (C++11以降)
template < class BidirIt, class Traits, class Alloc >

bool operator ! = ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(9) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

bool operator < ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(10) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

bool operator <= ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(11) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

bool operator > ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(12) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

bool operator >= ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(13) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

auto operator <=> ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(14) (C++20以降)
template < class BidirIt, class Traits, class Alloc >

bool operator == ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(15) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

bool operator ! = ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(16) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

bool operator < ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(17) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

bool operator <= ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(18) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

bool operator > ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(19) (C++11以降)
(C++20まで)
template < class BidirIt, class Traits, class Alloc >

bool operator >= ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(20) (C++11以降)
(C++20まで)
Cスタイル文字列との比較
template < class BidirIt >

bool operator == ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(21) (C++11以降)
template < class BidirIt >

bool operator ! = ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(22) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator < ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(23) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator <= ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(24) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator > ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(25) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator >= ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(26) (C++11以降)
(C++20まで)
template < class BidirIt >

auto operator <=> ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(27) (C++20以降)
template < class BidirIt >

bool operator == ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(28) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator ! = ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(29) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator < ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(30) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator <= ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(31) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator > ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(32) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator >= ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(33) (C++11以降)
(C++20まで)
単一文字との比較
template < class BidirIt >

bool operator == ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(34) (C++11以降)
template < class BidirIt >

bool operator ! = ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(35) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator < ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(36) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator <= ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(37) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator > ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(38) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator >= ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(39) (C++11以降)
(C++20まで)
template < class BidirIt >

auto operator <=> ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(40) (C++20以降)
template < class BidirIt >

bool operator == ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(41) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator ! = ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(42) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator < ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(43) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator <= ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(44) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator > ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(45) (C++11以降)
(C++20まで)
template < class BidirIt >

bool operator >= ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(46) (C++11以降)
(C++20まで)
ヘルパー型エイリアス
template < class BidirIt >

using /*value-type-of*/ =

typename std:: iterator_traits < BidirIt > :: value_type ;
(47) ( 説明専用* )
template < class BidirIt >

using /*cat-type-of*/ =
std:: compare_three_way_result_t

< std:: basic_string < /*value-type-of*/ < BidirIt >>> ;
(48) (C++20以降)
( 説明専用* )

sub_match を別の sub_match std::string 、C形式文字列、または単一文字と比較します。

1-7) 2つの sub_match を直接比較します。
8-20) sub_match std::basic_string と比較します。
21-33) sub_match をCスタイル文字列と比較します。
34-46) sub_match を単一文字と比較します。

< <= > >= 、および != 演算子は、それぞれ 合成 され、 operator <=> および operator == から生成されます。

(C++20以降)
47) value-type-of  < BidirIt > value type BidirIt です。
48) cat-type-of  < BidirIt > std:: sub_match < BidirIt > の三方比較の結果型です。

目次

パラメータ

lhs, rhs - 比較対象の sub_match
str - 比較対象の std::basic_string
s - 比較対象のCスタイル文字列へのポインタ
ch - 比較対象の文字

戻り値

以下の値で target を設定します:

1-7) rhs
8-20) typename std:: sub_match < BidirIt > :: string_type ( str. data ( ) , str. size ( ) )
21-33) s
34-46) typename std:: sub_match < BidirIt > :: string_type ( 1 , ch )

戻り値は以下のように定義されています:

演算子 戻り値
オーバーロード (1-14,21-27,34-40)
(パラメータ lhs を持つオーバーロード)
オーバーロード (15-20,28-33,41-46)
(パラメータ lhs を持たないオーバーロード)
== lhs. compare ( target ) == 0 rhs. compare ( target ) == 0
!= lhs. compare ( target ) ! = 0 rhs. compare ( target ) ! = 0
< lhs. compare ( target ) < 0 rhs. compare ( target ) > 0
<= lhs. compare ( target ) <= 0 rhs. compare ( target ) >= 0
> lhs. compare ( target ) > 0 rhs. compare ( target ) < 0
>= lhs. compare ( target ) >= 0 rhs. compare ( target ) <= 0
<=> static_cast < cat-type-of  < BidirIt >>
( lhs. compare ( target ) <=> 0 )
N/A

注記

operator <=> の戻り値の型は、比較カテゴリ型であることが保証されています。 value-type-of  < BidirIt > char wchar_t char8_t char16_t または char32_t の場合、 operator<=> の戻り値の型は std::strong_ordering です。

不具合報告

以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。

DR 適用対象 公開時の動作 正しい動作
LWG 2217 C++11 std::string との比較において、
compare() の引数は str. c_str ( ) であった
引数は
string_type ( str. data ( ) , str. size ( ) ) ) である

関連項目

マッチした部分シーケンス(存在する場合)を比較する
(public member function)