Namespaces
Variants

std::regex_token_iterator<BidirIt,CharT,Traits>:: regex_token_iterator

From cppreference.net
Regular expressions library
Classes
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
(注:このHTML要素には翻訳対象のテキストコンテンツが含まれていないため、元の構造をそのまま保持します)
regex_token_iterator ( ) ;
(1) (C++11以降)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type & re,
int submatch = 0 ,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) ;
(2) (C++11以降)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type & re,
const std:: vector < int > & submatches,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) ;
(3) (C++11以降)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type & re,
std:: initializer_list < int > submatches,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) ;
(4) (C++11以降)
template < std:: size_t N >

regex_token_iterator ( BidirIt a, BidirIt b,
const regex_type & re,
const int ( & submatches ) [ N ] ,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) ;
(5) (C++11以降)
regex_token_iterator ( const regex_token_iterator & other ) ;
(6) (C++11以降)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type && re,
int submatch = 0 ,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) = delete ;
(7) (C++11以降)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type && re,
const std:: vector < int > & submatches,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) = delete ;
(8) (C++11以降)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type && re,
std:: initializer_list < int > submatches,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) = delete ;
(9) (C++11以降)
template < std:: size_t N >

regex_token_iterator ( BidirIt a, BidirIt b,
const regex_type && re,
const int ( & submatches ) [ N ] ,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) = delete ;
(10) (C++11以降)

新しい regex_token_iterator を構築します:

1) デフォルトコンストラクタ。シーケンス終端イテレータを構築します。
2-5) まず、要求されたサブマッチのリストを submatches または submatch 引数からイテレータに格納されたメンバリストへコピーし、メンバ std::regex_iterator a b re m を4引数コンストラクタに渡して構築する(このコンストラクタは std::regex_search の初期呼び出しを実行する)。そして submatches の内部カウンタをゼロに設定する。
  • 構築後、メンバ regex_iterator がシーケンス終端イテレータでない場合、メンバポインタを現在の std::sub_match のアドレスに設定する。
  • それ以外の場合(メンバ regex_iterator がシーケンス終端イテレータである場合)、ただし値 - 1 submatches / submatch の値の1つである場合、 * this を範囲 [ a , b ) を指す サフィックスイテレータ に変換する(文字列全体が非マッチサフィックスとなる)。
  • それ以外の場合( - 1 submatches のリストに含まれない場合)、 * this をシーケンス終端イテレータに変換する。

submatches 内のいずれかの値が - 1 未満の場合、動作は未定義です。

6) コピーコンストラクタ: メンバー単位のコピーを実行します(メンバー regex_iterator および現在の sub_match へのメンバーポインタのコピーを含む)。
7-10) オーバーロード (2-5) は一時正規表現オブジェクトで呼び出すことが禁止されています。さもなければ返されるイテレータは即座に無効化されるためです。

パラメータ

a - LegacyBidirectionalIterator ターゲット文字シーケンスの先頭を指す
b - LegacyBidirectionalIterator ターゲット文字シーケンスの終端を指す
re - ターゲット文字シーケンスの検索に使用する正規表現
submatch - 返されるべき部分マッチのインデックス。"0"は完全一致を表し、"-1"は非一致部分を表す(例:マッチ間の部分)
submatches - 各マッチ内で反復処理されるべき部分マッチインデックスのシーケンス。非一致フラグメント用の特別な値 - 1 を含む場合がある
m - re の動作を制御するフラグ

不具合報告

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

DR 適用対象 公開時の動作 正しい動作
LWG 2332 C++11 一時的な regex_token_iterator から構築された
basic_regex は直ちに無効化された
削除されたオーバーロードによりそのような構築は許可されない