regex_token_iterator 類別
相符的 Iterator 類別。
template<class BidIt, class Elem = iterator_traits<BidIt>::value_type,
class RXtraits = regex_traits<Elem> >
class regex_token_iterator {
public:
typedef basic_regex<Elem, RXtraits> regex_type;
typedef sub_match<BidIt> value_type;
typedef std::forward_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
typedef const sub_match<BidIt> *pointer;
typedef const sub_match<BidIt>& reference;
regex_token_iterator();
regex_token_iterator(BidIt first, BidIt last,
const regex_type& re, int submatch = 0,
regex_constants::match_flag_type f = regex_constants::match_default);
regex_token_iterator(BidIt first, BidIt last,
const regex_type& re, const std::vector<int> submatches,
regex_constants::match_flag_type f = regex_constants::match_default);
template<std::size_t N>
regex_token_iterator(BidIt first, BidIt last,
const regex_type& re, const int (&submatches)[N],
regex_constants::match_flag_type f = regex_constants::match_default);
bool operator==(const regex_token_iterator& right);
bool operator!=(const regex_token_iterator& right);
const basic_string<Elem>& operator*();
const basic_string<Elem> *operator->();
regex_token_iterator& operator++();
regex_token_iterator& operator++(int);
private:
regex_iterator<BidIt, Elem, RXtraits> it; // exposition only
vector<int> subs; // exposition only
int pos; // exposition only
};
參數
BidIt
相符的 Iterator 型別。Elem
項目的型別對應。RXtraits
項目的特性類別。
備註
樣板類別描述常數正向 iterator 物件。 就概念上而言,它保存它使用搜尋字元序列的規則運算式相符項目的 regex_iterator 物件。 它會擷取表示相符的型別 sub_match<BidIt> 物件以儲存於中的向量的 subs 的索引值每個規則運算式比對的。
索引值 -1 在字元序列的開頭指定上一個規則運算式比對結尾後面的字元順序啟動或開始,如果沒有上一個規則運算式相符項目並將它擴充到,但不包括目前規則運算式相符項目的第一個字元,或是對字元序列結尾,如果目前沒有相符項目。 其他索引值 idx 會指定 it.match[idx]中所含的擷取群組的內容。
需求
標頭 : <regex>
命名空間: std