共用方式為


regex_token_iterator Class

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>

Namespace: 標準

請參閱

參考

<regex>

regex_token_iterator Class

regex_iterator Class

其他資源

<regex> 成員