608 lines
25 KiB
Markdown
608 lines
25 KiB
Markdown
[re.iter]
|
||
|
||
# 28 Text processing library [[text]](./#text)
|
||
|
||
## 28.6 Regular expressions library [[re]](re#iter)
|
||
|
||
### 28.6.11 Regular expression iterators [re.iter]
|
||
|
||
#### [28.6.11.1](#re.regiter) Class template regex_iterator [[re.regiter]](re.regiter)
|
||
|
||
#### [28.6.11.1.1](#re.regiter.general) General [[re.regiter.general]](re.regiter.general)
|
||
|
||
[1](#re.regiter.general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12225)
|
||
|
||
The class template regex_iterator is an iterator adaptor[.](#re.regiter.general-1.sentence-1)
|
||
|
||
It represents a new view of an existing iterator sequence, by
|
||
enumerating all the occurrences of a regular expression within that
|
||
sequence[.](#re.regiter.general-1.sentence-2)
|
||
|
||
A regex_iterator uses regex_search to find successive
|
||
regular expression matches within the sequence from which it was
|
||
constructed[.](#re.regiter.general-1.sentence-3)
|
||
|
||
After the iterator is constructed, and every time operator++ is
|
||
used, the iterator finds and stores a value ofmatch_results<BidirectionalIterator>[.](#re.regiter.general-1.sentence-4)
|
||
|
||
If the end of the sequence is
|
||
reached (regex_search returns false), the iterator becomes equal to
|
||
the end-of-sequence iterator value[.](#re.regiter.general-1.sentence-5)
|
||
|
||
The default constructor
|
||
constructs an end-of-sequence iterator object,
|
||
which is the only legitimate iterator to be used for the end
|
||
condition[.](#re.regiter.general-1.sentence-6)
|
||
|
||
The result of operator* on an end-of-sequence iterator is not
|
||
defined[.](#re.regiter.general-1.sentence-7)
|
||
|
||
For any other iterator value aconst match_results<BidirectionalIterator>& is returned[.](#re.regiter.general-1.sentence-8)
|
||
|
||
The result ofoperator-> on an end-of-sequence iterator is not defined[.](#re.regiter.general-1.sentence-9)
|
||
|
||
For any other
|
||
iterator value a const match_results<BidirectionalIterator>* is
|
||
returned[.](#re.regiter.general-1.sentence-10)
|
||
|
||
It is impossible to store things into regex_iterators[.](#re.regiter.general-1.sentence-11)
|
||
|
||
Two
|
||
end-of-sequence iterators are always equal[.](#re.regiter.general-1.sentence-12)
|
||
|
||
An end-of-sequence
|
||
iterator is not equal to a non-end-of-sequence iterator[.](#re.regiter.general-1.sentence-13)
|
||
|
||
Two
|
||
non-end-of-sequence iterators are equal when they are constructed from
|
||
the same arguments[.](#re.regiter.general-1.sentence-14)
|
||
|
||
namespace std {template<class BidirectionalIterator, class charT = typename iterator_traits<BidirectionalIterator>::value_type, class traits = regex_traits<charT>>class regex_iterator {public:using regex_type = basic_regex<charT, traits>; using iterator_category = forward_iterator_tag; using iterator_concept = input_iterator_tag; using value_type = match_results<BidirectionalIterator>; using difference_type = ptrdiff_t; using pointer = const value_type*; using reference = const value_type&;
|
||
|
||
regex_iterator();
|
||
regex_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
regex_iterator(BidirectionalIterator, BidirectionalIterator, const regex_type&&,
|
||
regex_constants::match_flag_type = regex_constants::match_default) = delete;
|
||
regex_iterator(const regex_iterator&);
|
||
regex_iterator& operator=(const regex_iterator&); bool operator==(const regex_iterator&) const; bool operator==(default_sentinel_t) const { return *this == regex_iterator(); }const value_type& operator*() const; const value_type* operator->() const;
|
||
regex_iterator& operator++();
|
||
regex_iterator operator++(int); private: BidirectionalIterator begin; // *exposition only* BidirectionalIterator end; // *exposition only*const regex_type* pregex; // *exposition only* regex_constants::match_flag_type flags; // *exposition only* match_results<BidirectionalIterator> match; // *exposition only*};}
|
||
|
||
[2](#re.regiter.general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12292)
|
||
|
||
An object of type regex_iterator that is not an end-of-sequence iterator
|
||
holds a *zero-length match* if match[0].matched == true andmatch[0].first == match[0].second[.](#re.regiter.general-2.sentence-1)
|
||
|
||
[*Note [1](#re.regiter.general-note-1)*:
|
||
|
||
For
|
||
example, this can occur when the part of the regular expression that
|
||
matched consists only of an assertion (such as `'^'`, `'$'`,'\b', '\B')[.](#re.regiter.general-2.sentence-2)
|
||
|
||
â *end note*]
|
||
|
||
#### [28.6.11.1.2](#re.regiter.cnstr) Constructors [[re.regiter.cnstr]](re.regiter.cnstr)
|
||
|
||
[ð](#lib:regex_iterator,constructor)
|
||
|
||
`regex_iterator();
|
||
`
|
||
|
||
[1](#re.regiter.cnstr-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12311)
|
||
|
||
*Effects*: Constructs an end-of-sequence iterator[.](#re.regiter.cnstr-1.sentence-1)
|
||
|
||
[ð](#lib:regex_iterator,constructor_)
|
||
|
||
`regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
`
|
||
|
||
[2](#re.regiter.cnstr-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12324)
|
||
|
||
*Effects*: Initializes begin and end toa and b, respectively, setspregex to addressof(re), sets flags tom, then calls regex_search(begin, end, match, *pregex, flags)[.](#re.regiter.cnstr-2.sentence-1)
|
||
|
||
If this
|
||
call returns false the constructor sets *this to the end-of-sequence
|
||
iterator[.](#re.regiter.cnstr-2.sentence-2)
|
||
|
||
#### [28.6.11.1.3](#re.regiter.comp) Comparisons [[re.regiter.comp]](re.regiter.comp)
|
||
|
||
[ð](#lib:regex_iterator,operator==)
|
||
|
||
`bool operator==(const regex_iterator& right) const;
|
||
`
|
||
|
||
[1](#re.regiter.comp-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12342)
|
||
|
||
*Returns*: true if *this and right are both end-of-sequence
|
||
iterators or if the following conditions all hold:
|
||
|
||
- [(1.1)](#re.regiter.comp-1.1)
|
||
|
||
begin == right.begin,
|
||
|
||
- [(1.2)](#re.regiter.comp-1.2)
|
||
|
||
end == right.end,
|
||
|
||
- [(1.3)](#re.regiter.comp-1.3)
|
||
|
||
pregex == right.pregex,
|
||
|
||
- [(1.4)](#re.regiter.comp-1.4)
|
||
|
||
flags == right.flags, and
|
||
|
||
- [(1.5)](#re.regiter.comp-1.5)
|
||
|
||
match[0] == right.match[0];
|
||
|
||
otherwise false[.](#re.regiter.comp-1.sentence-1)
|
||
|
||
#### [28.6.11.1.4](#re.regiter.deref) Indirection [[re.regiter.deref]](re.regiter.deref)
|
||
|
||
[ð](#lib:regex_iterator,operator*)
|
||
|
||
`const value_type& operator*() const;
|
||
`
|
||
|
||
[1](#re.regiter.deref-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12364)
|
||
|
||
*Returns*: match[.](#re.regiter.deref-1.sentence-1)
|
||
|
||
[ð](#lib:operator-%3e,regex_iterator)
|
||
|
||
`const value_type* operator->() const;
|
||
`
|
||
|
||
[2](#re.regiter.deref-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12375)
|
||
|
||
*Returns*: addressof(match)[.](#re.regiter.deref-2.sentence-1)
|
||
|
||
#### [28.6.11.1.5](#re.regiter.incr) Increment [[re.regiter.incr]](re.regiter.incr)
|
||
|
||
[ð](#lib:regex_iterator,operator++)
|
||
|
||
`regex_iterator& operator++();
|
||
`
|
||
|
||
[1](#re.regiter.incr-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12389)
|
||
|
||
*Effects*: Constructs a local variable start of type BidirectionalIterator and
|
||
initializes it with the value of match[0].second[.](#re.regiter.incr-1.sentence-1)
|
||
|
||
[2](#re.regiter.incr-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12394)
|
||
|
||
If the iterator holds a zero-length match and start == end the operator
|
||
sets *this to the end-of-sequence iterator and returns *this[.](#re.regiter.incr-2.sentence-1)
|
||
|
||
[3](#re.regiter.incr-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12398)
|
||
|
||
Otherwise, if the iterator holds a zero-length match, the operator calls:regex_search(start, end, match, *pregex,
|
||
flags | regex_constants::match_not_null | regex_constants::match_continuous)
|
||
|
||
If the call returns true the operator
|
||
returns *this[.](#re.regiter.incr-3.sentence-2)
|
||
|
||
Otherwise the operator increments start and continues as if
|
||
the most recent match was not a zero-length match[.](#re.regiter.incr-3.sentence-3)
|
||
|
||
[4](#re.regiter.incr-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12410)
|
||
|
||
If the most recent match was not a zero-length match, the operator setsflags to flags | regex_constants::match_prev_avail and
|
||
calls regex_search(start, end, match, *pregex, flags)[.](#re.regiter.incr-4.sentence-1)
|
||
|
||
If the call returnsfalse the iterator sets *this to the end-of-sequence iterator[.](#re.regiter.incr-4.sentence-2)
|
||
|
||
The
|
||
iterator then returns *this[.](#re.regiter.incr-4.sentence-3)
|
||
|
||
[5](#re.regiter.incr-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12418)
|
||
|
||
In all cases in which the call to regex_search returns true,match.prefix().first shall be equal to the previous value ofmatch[0].second, and for each index i in the half-open range
|
||
[0, match.size()) for which match[i].matched is true,match.position(i) shall return distance(begin, match[i].first)[.](#re.regiter.incr-5.sentence-1)
|
||
|
||
[6](#re.regiter.incr-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12426)
|
||
|
||
[*Note [1](#re.regiter.incr-note-1)*:
|
||
|
||
This means that match.position(i) gives the
|
||
offset from the beginning of the target sequence, which is often not
|
||
the same as the offset from the sequence passed in the call
|
||
to regex_search[.](#re.regiter.incr-6.sentence-1)
|
||
|
||
â *end note*]
|
||
|
||
[7](#re.regiter.incr-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12434)
|
||
|
||
It is unspecified how the implementation makes these adjustments[.](#re.regiter.incr-7.sentence-1)
|
||
|
||
[8](#re.regiter.incr-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12437)
|
||
|
||
[*Note [2](#re.regiter.incr-note-2)*:
|
||
|
||
This means that an implementation can call an
|
||
implementation-specific search function, in which case a program-defined
|
||
specialization of regex_search will not be
|
||
called[.](#re.regiter.incr-8.sentence-1)
|
||
|
||
â *end note*]
|
||
|
||
[ð](#lib:regex_iterator,operator++_)
|
||
|
||
`regex_iterator operator++(int);
|
||
`
|
||
|
||
[9](#re.regiter.incr-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12452)
|
||
|
||
*Effects*: As if by:regex_iterator tmp = *this;++(*this);return tmp;
|
||
|
||
#### [28.6.11.2](#re.tokiter) Class template regex_token_iterator [[re.tokiter]](re.tokiter)
|
||
|
||
#### [28.6.11.2.1](#re.tokiter.general) General [[re.tokiter.general]](re.tokiter.general)
|
||
|
||
[1](#re.tokiter.general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12466)
|
||
|
||
The class template regex_token_iterator is an iterator adaptor; that
|
||
is to say it represents a new view of an existing iterator sequence,
|
||
by enumerating all the occurrences of a regular expression within that
|
||
sequence, and presenting one or more sub-expressions for each match
|
||
found[.](#re.tokiter.general-1.sentence-1)
|
||
|
||
Each position enumerated by the iterator is a sub_match class
|
||
template instance that represents what matched a particular sub-expression
|
||
within the regular expression[.](#re.tokiter.general-1.sentence-2)
|
||
|
||
[2](#re.tokiter.general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12476)
|
||
|
||
When class regex_token_iterator is used to enumerate a
|
||
single sub-expression with index â1 the iterator performs field
|
||
splitting: that is to say it enumerates one sub-expression for each section of
|
||
the character container sequence that does not match the regular
|
||
expression specified[.](#re.tokiter.general-2.sentence-1)
|
||
|
||
[3](#re.tokiter.general-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12483)
|
||
|
||
After it is constructed, the iterator finds and stores a valueregex_iterator<BidirectionalIterator> position and sets the internal count N to zero[.](#re.tokiter.general-3.sentence-1)
|
||
|
||
It also maintains a sequencesubs which contains a list of the sub-expressions which will be
|
||
enumerated[.](#re.tokiter.general-3.sentence-2)
|
||
|
||
Every time operator++ is used
|
||
the count N is incremented; if N exceeds or equals subs.size(),
|
||
then the iterator increments member position and sets count N to zero[.](#re.tokiter.general-3.sentence-3)
|
||
|
||
[4](#re.tokiter.general-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12494)
|
||
|
||
If the end of sequence is reached (position is equal to the end of
|
||
sequence iterator), the iterator becomes equal to the end-of-sequence
|
||
iterator value, unless the sub-expression being enumerated has index â1,
|
||
in which case the iterator enumerates one last sub-expression that contains
|
||
all the characters from the end of the last regular expression match to the
|
||
end of the input sequence being enumerated, provided that this would not be an
|
||
empty sub-expression[.](#re.tokiter.general-4.sentence-1)
|
||
|
||
[5](#re.tokiter.general-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12503)
|
||
|
||
The default constructor constructs
|
||
an end-of-sequence iterator object, which is the only legitimate
|
||
iterator to be used for the end condition[.](#re.tokiter.general-5.sentence-1)
|
||
|
||
The result of operator* on
|
||
an end-of-sequence iterator is not defined[.](#re.tokiter.general-5.sentence-2)
|
||
|
||
For any other iterator value aconst sub_match<BidirectionalIterator>& is returned[.](#re.tokiter.general-5.sentence-3)
|
||
|
||
The result of operator-> on an end-of-sequence iterator
|
||
is not defined[.](#re.tokiter.general-5.sentence-4)
|
||
|
||
For any other iterator value a const sub_match<BidirectionalIterator>* is returned[.](#re.tokiter.general-5.sentence-5)
|
||
|
||
[6](#re.tokiter.general-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12514)
|
||
|
||
It is impossible to store things
|
||
into regex_token_iterators[.](#re.tokiter.general-6.sentence-1)
|
||
|
||
Two end-of-sequence iterators are always
|
||
equal[.](#re.tokiter.general-6.sentence-2)
|
||
|
||
An end-of-sequence iterator is not equal to a
|
||
non-end-of-sequence iterator[.](#re.tokiter.general-6.sentence-3)
|
||
|
||
Two non-end-of-sequence iterators are
|
||
equal when they are constructed from the same arguments[.](#re.tokiter.general-6.sentence-4)
|
||
|
||
namespace std {template<class BidirectionalIterator, class charT = typename iterator_traits<BidirectionalIterator>::value_type, class traits = regex_traits<charT>>class regex_token_iterator {public:using regex_type = basic_regex<charT, traits>; using iterator_category = forward_iterator_tag; using iterator_concept = input_iterator_tag; using value_type = sub_match<BidirectionalIterator>; using difference_type = ptrdiff_t; using pointer = const value_type*; using reference = const value_type&;
|
||
|
||
regex_token_iterator();
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, int submatch = 0,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const vector<int>& submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||
initializer_list<int> submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default); template<size_t N> regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const int (&submatches)[N],
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type&& re, int submatch = 0,
|
||
regex_constants::match_flag_type m = regex_constants::match_default) = delete;
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type&& re, const vector<int>& submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default) = delete;
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type&& re,
|
||
initializer_list<int> submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default) = delete; template<size_t N> regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type&& re, const int (&submatches)[N],
|
||
regex_constants::match_flag_type m = regex_constants::match_default) = delete;
|
||
regex_token_iterator(const regex_token_iterator&);
|
||
regex_token_iterator& operator=(const regex_token_iterator&); bool operator==(const regex_token_iterator&) const; bool operator==(default_sentinel_t) const { return *this == regex_token_iterator(); }const value_type& operator*() const; const value_type* operator->() const;
|
||
regex_token_iterator& operator++();
|
||
regex_token_iterator operator++(int); private:using position_iterator = regex_iterator<BidirectionalIterator, charT, traits>; // *exposition only* position_iterator position; // *exposition only*const value_type* result; // *exposition only* value_type suffix; // *exposition only* size_t N; // *exposition only* vector<int> subs; // *exposition only*};}
|
||
|
||
[7](#re.tokiter.general-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12601)
|
||
|
||
A *suffix iterator* is a regex_token_iterator object
|
||
that points to a final sequence of characters at
|
||
the end of the target sequence[.](#re.tokiter.general-7.sentence-1)
|
||
|
||
In a suffix iterator the
|
||
member result holds a pointer to the data
|
||
member suffix, the value of the member suffix.match is true, suffix.first points to the beginning of the
|
||
final sequence, and suffix.second points to the end of the
|
||
final sequence[.](#re.tokiter.general-7.sentence-2)
|
||
|
||
[8](#re.tokiter.general-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12611)
|
||
|
||
[*Note [1](#re.tokiter.general-note-1)*:
|
||
|
||
For a suffix iterator, data
|
||
member suffix.first is the same as the end of the last match
|
||
found, and suffix.second is the same as the end of the target
|
||
sequence[.](#re.tokiter.general-8.sentence-1)
|
||
|
||
â *end note*]
|
||
|
||
[9](#re.tokiter.general-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12619)
|
||
|
||
The *current match* is (*position).prefix() if subs[N] == -1, or(*position)[subs[N]] for any other value of subs[N][.](#re.tokiter.general-9.sentence-1)
|
||
|
||
#### [28.6.11.2.2](#re.tokiter.cnstr) Constructors [[re.tokiter.cnstr]](re.tokiter.cnstr)
|
||
|
||
[ð](#lib:regex_token_iterator,constructor)
|
||
|
||
`regex_token_iterator();
|
||
`
|
||
|
||
[1](#re.tokiter.cnstr-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12631)
|
||
|
||
*Effects*: Constructs the end-of-sequence iterator[.](#re.tokiter.cnstr-1.sentence-1)
|
||
|
||
[ð](#lib:regex_token_iterator,constructor_)
|
||
|
||
`regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
int submatch = 0,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
const vector<int>& submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
initializer_list<int> submatches,
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
|
||
template<size_t N>
|
||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
||
const regex_type& re,
|
||
const int (&submatches)[N],
|
||
regex_constants::match_flag_type m = regex_constants::match_default);
|
||
`
|
||
|
||
[2](#re.tokiter.cnstr-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12661)
|
||
|
||
*Preconditions*: Each of the initialization values of submatches is >= -1[.](#re.tokiter.cnstr-2.sentence-1)
|
||
|
||
[3](#re.tokiter.cnstr-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12665)
|
||
|
||
*Effects*: The first constructor initializes the member subs to hold the single
|
||
value submatch[.](#re.tokiter.cnstr-3.sentence-1)
|
||
|
||
The second, third, and fourth constructors
|
||
initialize the member subs to hold a copy of the sequence of integer values
|
||
pointed to by the iterator range
|
||
[begin(submatches), end(submatches))[.](#re.tokiter.cnstr-3.sentence-2)
|
||
|
||
[4](#re.tokiter.cnstr-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12674)
|
||
|
||
Each constructor then sets N to 0, and position toposition_iterator(a, b, re, m)[.](#re.tokiter.cnstr-4.sentence-1)
|
||
|
||
If position is not an
|
||
end-of-sequence iterator the constructor sets result to the
|
||
address of the current match[.](#re.tokiter.cnstr-4.sentence-2)
|
||
|
||
Otherwise if any of the values stored
|
||
in subs is equal to â1 the constructor sets *this to a suffix
|
||
iterator that points to the range [a, b), otherwise the constructor
|
||
sets *this to an end-of-sequence iterator[.](#re.tokiter.cnstr-4.sentence-3)
|
||
|
||
#### [28.6.11.2.3](#re.tokiter.comp) Comparisons [[re.tokiter.comp]](re.tokiter.comp)
|
||
|
||
[ð](#lib:regex_token_iterator,operator==_)
|
||
|
||
`bool operator==(const regex_token_iterator& right) const;
|
||
`
|
||
|
||
[1](#re.tokiter.comp-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12692)
|
||
|
||
*Returns*: true if *this and right are both end-of-sequence iterators,
|
||
or if *this and right are both suffix iterators and suffix == right.suffix;
|
||
otherwise returns false if *this or right is an end-of-sequence
|
||
iterator or a suffix iterator[.](#re.tokiter.comp-1.sentence-1)
|
||
|
||
Otherwise returns true if position == right.position,N == right.N, and subs == right.subs[.](#re.tokiter.comp-1.sentence-2)
|
||
|
||
Otherwise returns false[.](#re.tokiter.comp-1.sentence-3)
|
||
|
||
#### [28.6.11.2.4](#re.tokiter.deref) Indirection [[re.tokiter.deref]](re.tokiter.deref)
|
||
|
||
[ð](#lib:regex_token_iterator,operator*)
|
||
|
||
`const value_type& operator*() const;
|
||
`
|
||
|
||
[1](#re.tokiter.deref-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12709)
|
||
|
||
*Returns*: *result[.](#re.tokiter.deref-1.sentence-1)
|
||
|
||
[ð](#lib:operator-%3e,regex_token_iterator)
|
||
|
||
`const value_type* operator->() const;
|
||
`
|
||
|
||
[2](#re.tokiter.deref-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12720)
|
||
|
||
*Returns*: result[.](#re.tokiter.deref-2.sentence-1)
|
||
|
||
#### [28.6.11.2.5](#re.tokiter.incr) Increment [[re.tokiter.incr]](re.tokiter.incr)
|
||
|
||
[ð](#lib:regex_token_iterator,operator++)
|
||
|
||
`regex_token_iterator& operator++();
|
||
`
|
||
|
||
[1](#re.tokiter.incr-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12734)
|
||
|
||
*Effects*: Constructs a local variable prev of
|
||
type position_iterator, initialized with the value
|
||
of position[.](#re.tokiter.incr-1.sentence-1)
|
||
|
||
[2](#re.tokiter.incr-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12740)
|
||
|
||
If *this is a suffix iterator, sets *this to an
|
||
end-of-sequence iterator[.](#re.tokiter.incr-2.sentence-1)
|
||
|
||
[3](#re.tokiter.incr-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12744)
|
||
|
||
Otherwise, if N + 1 < subs.size(), increments N and
|
||
sets result to the address of the current match[.](#re.tokiter.incr-3.sentence-1)
|
||
|
||
[4](#re.tokiter.incr-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12748)
|
||
|
||
Otherwise, sets N to 0 and
|
||
increments position[.](#re.tokiter.incr-4.sentence-1)
|
||
|
||
If position is not an
|
||
end-of-sequence iterator the operator sets result to the
|
||
address of the current match[.](#re.tokiter.incr-4.sentence-2)
|
||
|
||
[5](#re.tokiter.incr-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12754)
|
||
|
||
Otherwise, if any of the values stored in subs is equal to â1 andprev->suffix().length() is not 0 the operator sets *this to a
|
||
suffix iterator that points to the range [prev->suffix().first, prev->suffix().second)[.](#re.tokiter.incr-5.sentence-1)
|
||
|
||
[6](#re.tokiter.incr-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12759)
|
||
|
||
Otherwise, sets *this to an end-of-sequence iterator[.](#re.tokiter.incr-6.sentence-1)
|
||
|
||
[7](#re.tokiter.incr-7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12762)
|
||
|
||
*Returns*: *this[.](#re.tokiter.incr-7.sentence-1)
|
||
|
||
[ð](#lib:regex_token_iterator,operator++_)
|
||
|
||
`regex_token_iterator& operator++(int);
|
||
`
|
||
|
||
[8](#re.tokiter.incr-8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12773)
|
||
|
||
*Effects*: Constructs a copy tmp of *this, then calls ++(*this)[.](#re.tokiter.incr-8.sentence-1)
|
||
|
||
[9](#re.tokiter.incr-9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L12777)
|
||
|
||
*Returns*: tmp[.](#re.tokiter.incr-9.sentence-1)
|