| Home | Libraries | People | FAQ | More

## Struct template regex_token_iterator

boost::xpressive::regex_token_iterator —

## Synopsis

    template<typename BidiIter>
    struct regex_token_iterator {
      // types
      typedef basic_regex< BidiIter >               regex_type;
      typedef iterator_value< BidiIter >::type      char_type;
      typedef std::basic_string< char_type >        value_type;
      typedef iterator_difference< BidiIter >::type difference_type;
      typedef value_type const *                    pointer;
      typedef value_type const &                    reference;
      typedef std::forward_iterator_tag             iterator_category;

      // construct/copy/destruct
      regex_token_iterator();
      regex_token_iterator(BidiIter, BidiIter, basic_regex< BidiIter > const &);
      template<typename SubMatches>
        regex_token_iterator(BidiIter, BidiIter, basic_regex< BidiIter > const &,
                             SubMatches const &,
                             regex_constants::match_flag_type = regex_constants::match_default);
      regex_token_iterator(regex_token_iterator< BidiIter > const &);
      regex_token_iterator& operator=(regex_token_iterator< BidiIter > const &);

      // public member functions
      value_type const & operator *() const;
      value_type const * operator->() const;
      regex_token_iterator< BidiIter > & operator++() ;
      regex_token_iterator< BidiIter > operator++(int) ;
    };

## Description

### `regex_token_iterator` construct/copy/destruct

1.     regex_token_iterator();

2.     regex_token_iterator(BidiIter begin, BidiIter end,
                            basic_regex< BidiIter > const & rex);

3.     template<typename SubMatches>
         regex_token_iterator(BidiIter begin, BidiIter end,
                              basic_regex< BidiIter > const & rex,
                              SubMatches const & sub_matches,
                              regex_constants::match_flag_type flags = regex_constants::match_default);

4.     regex_token_iterator(regex_token_iterator< BidiIter > const & that);

5.     regex_token_iterator& operator=(regex_token_iterator< BidiIter > const & that);

### `regex_token_iterator` public member functions

1.     value_type const & operator *() const;

2.     value_type const * operator->() const;

3.     regex_token_iterator< BidiIter > & operator++() ;

   If N == -1 then sets *this equal to the end of sequence iterator. Otherwise if N+1 < subs.size(), then increments N and sets result equal to ((subs[N] == -1) ? value_type(what.prefix().str()) : value_type(what[subs[N]].str())). Otherwise if what.prefix().first != what[0].second and if the element match_prev_avail is not set in flags then sets it. Then locates the next match as if by calling regex_search(what[0].second, end, what, *pre, flags), with the following variation: in the event that the previous match found was of zero length (what[0].length() == 0) then attempts to find a non-zero length match starting at what[0].second, only if that fails and provided what[0].second != suffix().second does it look for a (possibly zero length) match starting from what[0].second + 1. If such a match is found then sets N equal to zero, and sets result equal to ((subs[N] == -1) ? value_type(what.prefix().str()) : value_type(what[subs[N]].str())). Otherwise if no further matches were found, then let last_end be the endpoint of the last match that was found. Then if last_end != end and subs[0] == -1 sets N equal to -1 and sets result equal to value_type(last_end, end). Otherwise sets *this equal to the end of sequence iterator.

4.     regex_token_iterator< BidiIter > operator++(int) ;

| Copyright © 2003, 2004 Eric Niebler