sub_match 構造体テンプレート
-
template<typename BidiIter>
struct sub_match : public std::pair<BidiIter, BidiIter> sub_matchクラステンプレートは、個々のマーク済み部分式にマッチした文字シーケンスを表す。
概要
// ヘッダ:<boost/xpressive/sub_match.hpp> template<typename BidiIter> structsub_match: public std::pair< BidiIter, BidiIter > { // 型 typedef iterator_value< BidiIter >::type value_type; typedef iterator_difference< BidiIter >::type difference_type; typedefunspecifiedstring_type; typedef BidiIter iterator; // 構築、コピー、解体sub_match();sub_match(BidiIter, BidiIter, bool = false); // 公開メンバ関数 string_typestr() const;operator string_type() const; difference_typelength() const;operator bool_type() const; booloperator!() const; intcompare(string_type const &) const; intcompare(sub_matchconst &) const; intcompare(value_type const *) const; // 公開データメンバ bool matched; // この部分マッチが全体マッチに関与していれば真。 };
説明
sub_match<> 型のオブジェクトが表すマーク済み部分式が正規表現マッチに関与している場合、メンバ matched は真と評価されメンバ first および second はマッチを形成する文字範囲 [first,second) を表す。それ以外の場合、matched は偽でありメンバ first および second に未定義の値が入る。
sub_match<> 型のオブジェクトが 0 番目の部分式、つまりマッチ全体を表す場合、メンバ matched は常に真である。ただし、フラグ match_partial を正規表現アルゴリズムを渡して部分マッチが得られた場合は例外である。この場合メンバ matched は偽であり、メンバ first および second は部分マッチを形成する文字範囲を表す。
sub_match 構築、コピー、解体の公開演算
-
sub_match()
-
sub_match(BidiIter first, BidiIter second, bool matched_ = false)
sub_match 公開メンバ関数
-
string_type str() const
-
operator string_type() const
-
difference_type length() const
-
operator bool_type() const
-
bool operator!() const
-
int compare(string_type const &str) const
字句的な文字列比較を行う。
- パラメータ
str -- 比較する文字列
- 戻り値
(*this).str().compare(str) の結果
-
int compare(sub_match const &sub) const
利便性のためのメンバ関数多重定義。上記関数と受け取る引数が異なるのみ。
-
int compare(value_type const *ptr) const