std:: match_results
|
ヘッダーで定義
<regex>
|
||
|
template
<
class
BidirIt,
|
(1) | (C++11以降) |
|
namespace
pmr
{
template
<
class
BidirIt
>
|
(2) | (C++17以降) |
クラステンプレート
std::match_results
は、正規表現マッチの結果を表す文字シーケンスのコレクションを保持します。
これは特殊なアロケータ対応コンテナです。デフォルト構築されるか、
std::regex_iterator
から取得されるか、
std::regex_search
または
std::regex_match
によって変更されることのみが可能です。
std::match_results
は
std::sub_match
を保持しており、それぞれがマッチした元の文字シーケンスへのイテレータのペアであるため、元の文字シーケンスが破棄された場合や、そのイテレータが他の理由で無効化された場合に
std::match_results
を検査することは未定義動作となります。
正規表現によるターゲットシーケンス内の完全一致を常に表すのは、
std::match_result
に含まれる最初の
std::sub_match
(インデックス0)であり、それに続く
std::sub_match
は、正規表現内の部分式を区切る左括弧の順序に対応する部分式の一致を表します。
std::match_results
は、
AllocatorAwareContainer
および
SequenceContainer
の要件を満たすが、コピー代入、ムーブ代入、および定数コンテナに対して定義された操作のみがサポートされており、比較関数のセマンティクスがコンテナに要求されるものとは異なる点を除く。
目次 |
型要件
-
BidirIt
は
LegacyBidirectionalIterator
の要件を満たさなければならない。
|
||
-
Alloc
は
Allocator
の要件を満たさなければならない。
|
特殊化
一般的な文字シーケンス型に対するいくつかの特殊化が提供されています:
|
定義済みヘッダー
<regex>
|
|
| 型 | 定義 |
std::cmatch
|
std :: match_results < const char * > |
std::wcmatch
|
std :: match_results < const wchar_t * > |
std::smatch
|
std :: match_results < std :: string :: const_iterator > |
std::wsmatch
|
std :: match_results < std :: wstring :: const_iterator > |
std::pmr::cmatch
(C++17)
|
std :: pmr :: match_results < const char * > |
std::pmr::wcmatch
(C++17)
|
std :: pmr :: match_results < const wchar_t * > |
std::pmr::smatch
(C++17)
|
std :: pmr :: match_results < std :: string :: const_iterator > |
std::pmr::wsmatch
(C++17)
|
std :: pmr :: match_results < std :: wstring :: const_iterator > |
メンバー型
| メンバ型 | 定義 |
allocator_type
|
Allocator
|
value_type
|
std:: sub_match < BidirIt > |
const_reference
|
const value_type & |
reference
|
value_type&
|
const_iterator
|
実装定義 (基となるコンテナに依存) |
iterator
|
const_iterator
|
difference_type
|
std:: iterator_traits < BidirIt > :: difference_type |
size_type
|
std:: allocator_traits < Alloc > :: size_type |
char_type
|
std:: iterator_traits < BidirIt > :: value_type |
string_type
|
std:: basic_string < char_type > |
メンバー関数
|
オブジェクトを構築する
(public member function) |
|
|
オブジェクトを破棄する
(public member function) |
|
|
内容を代入する
(public member function) |
|
|
関連付けられたアロケータを返す
(public member function) |
|
状態 |
|
|
結果が利用可能かチェックする
(public member function) |
|
サイズ |
|
|
マッチが成功したかチェックする
(public member function) |
|
|
完全に確立された結果状態でのマッチ数を返す
(public member function) |
|
|
可能なサブマッチの最大数を返す
(public member function) |
|
要素アクセス |
|
|
特定のサブマッチの長さを返す
(public member function) |
|
|
特定のサブマッチの最初の文字の位置を返す
(public member function) |
|
|
特定のサブマッチの文字シーケンスを返す
(public member function) |
|
|
指定されたサブマッチを返す
(public member function) |
|
|
ターゲットシーケンスの先頭と完全マッチの先頭の間のサブシーケンスを返す
(public member function) |
|
|
完全マッチの終端とターゲットシーケンスの終端の間のサブシーケンスを返す
(public member function) |
|
イテレータ |
|
|
サブマッチリストの先頭へのイテレータを返す
(public member function) |
|
|
サブマッチリストの終端へのイテレータを返す
(public member function) |
|
フォーマット |
|
|
出力用にマッチ結果をフォーマットする
(public member function) |
|
変更子 |
|
|
内容を交換する
(public member function) |
|
非メンバー関数
|
(C++20で削除)
|
2つのマッチ結果の値を辞書順で比較する
(関数テンプレート) |
|
(C++11)
|
std::swap
アルゴリズムを特殊化する
(関数テンプレート) |