子匹配项的迭代器类。
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
子匹配项的迭代器类型。Elem
元素的类型要匹配的。RXtraits
特征为组件类。
备注
模板类描述常数的前向迭代器对象。从概念上讲,它保留它使用搜索在字符序列的正则表达式匹配的一 regex_iterator 对象。它提取表示子匹配项的类型 sub_match<BidIt> 对象确定由存储的向量 subs 的索引值每个正则表达式匹配的。
索引值的 -1 在字符序列的开头指定在前面的正则表达式匹配的后面的字符序列开头或开头,如果没有上一个正则表达式匹配和扩展到,但不包含当前正则表达式匹配的第一个字符,或对字符序列的结尾,如果当前没有匹配。其他索引值 idx 指定在 it.match[idx]保存的捕获组的内容。
要求
**标题:**regex
命名空间: std