本文整理汇总了C++中basic_regex::mark_count方法的典型用法代码示例。如果您正苦于以下问题:C++ basic_regex::mark_count方法的具体用法?C++ basic_regex::mark_count怎么用?C++ basic_regex::mark_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类basic_regex
的用法示例。
在下文中一共展示了basic_regex::mark_count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: regex_split
std::size_t regex_split(OutputIterator out,
std::basic_string<charT, Traits1, Alloc1>& s,
const basic_regex<charT, Traits2>& e,
match_flag_type flags,
std::size_t max_split)
{
typedef typename std::basic_string<charT, Traits1, Alloc1>::const_iterator ci_t;
//typedef typename match_results<ci_t>::allocator_type match_allocator;
ci_t last = s.begin();
std::size_t init_size = max_split;
re_detail::split_pred<OutputIterator, charT, Traits1, Alloc1> pred(&last, &out, &max_split);
ci_t i, j;
i = s.begin();
j = s.end();
regex_grep(pred, i, j, e, flags);
//
// if there is still input left, do a final push as long as max_split
// is not exhausted, and we're not splitting sub-expressions rather
// than whitespace:
if(max_split && (last != s.end()) && (e.mark_count() == 0))
{
*out = std::basic_string<charT, Traits1, Alloc1>((ci_t)last, (ci_t)s.end());
++out;
last = s.end();
--max_split;
}
//
// delete from the string everything that has been processed so far:
s.erase(0, last - s.begin());
//
// return the number of new records pushed:
return init_size - max_split;
}