다음을 통해 공유


regex_iterator Class

Iterator class for matches.

template<class BidIt, class Elem = iterator_traits<BidIt>::value_type,
    class RXtraits = regex_traits<Elem> >
        class regex_iterator {
public:
    typedef basic_regex<Elem, RXtraits> regex_type;
    typedef match_results<BidIt> value_type;
    typedef std::forward_iterator_tag iterator_category;
    typedef std::ptrdiff_t difference_type;
    typedef const match_results<BidIt>* pointer;
    typedef const match_results<BidIt>& reference;

    regex_iterator();
    regex_iterator(BidIt first, BidIt last,
        const regex_type& re,
        regex_constants::match_flag_type f = regex_constants::match_default);

    bool operator==(const regex_iterator& right);
    bool operator!=(const regex_iterator& right);
    const match_results<BidIt>& operator*();
    const match_results<BidIt> *operator->();
    regex_iterator& operator++();
    regex_iterator& operator++(int);

    BidIt begin;                            // exposition only
    BidIt end;                              // exposition only
    regex_type *pregex;                     // exposition only
    regex_constants::match_flag_type flags; // exposition only
    match_results<BidIt> match;             // exposition only
    };

Parameters

  • BidIt
    The iterator type for submatches.

  • Elem
    The type of elements to match.

  • RXtraits
    Traits class for elements.

Remarks

The template class describes a constant forward iterator object. It extracts objects of type match_results<BidIt> by repeatedly applying its regular expression object *pregex to the character sequence defined by the iterator range [begin, end).

Examples

See the following topics for examples on regular expressions:

Requirements

Header: <regex>

Namespace: std

See Also

Reference

<regex>

regex_iterator Class