std::regex_iterator<BidirIt,CharT,Traits>:: operator++, operator++ (int)
|
regex_iterator
&
operator
++
(
)
;
|
(自 C++11 起) | |
|
regex_iterator operator
++
(
int
)
;
|
(自 C++11 起) | |
将迭代器前进到下一个匹配项。
|
本节内容尚不完整
原因:需要更详细的说明 |
首先,构造一个类型为
BidirIt
的局部变量,其值为
match
[
0
]
.
second
。
如果迭代器包含零长度匹配且 start == end , * this 将被设为序列结束迭代器,函数随即返回。
否则,如果迭代器包含零长度匹配,该运算符将调用以下内容:
regex_search
(
start, end, match,
*
pregex,
flags
|
regex_constants
::
match_not_null
|
regex_constants
::
match_continuous
)
;
如果调用返回 true ,函数将返回。
否则该操作符将递增
start
并继续执行,如同最近一次匹配不是零长度匹配。
如果最近一次匹配不是零长度匹配,该操作符会将
flags
设置为
flags
|
regex_constants
::
match_prev_avail
并调用以下操作:
regex_search ( start, end, match, * pregex, flags ) ;
如果调用返回 false ,迭代器会将 * this 设为结束序列迭代器,函数随即返回。
在所有
regex_search
调用返回
true
的情况下,
match.
prefix
(
)
.
first
将等于
match
[
0
]
.
second
的前一个值,并且对于范围
[
0
,
match.
size
(
)
)
内每个满足
match
[
i
]
.
matched
为
true
的索引i,
match
[
i
]
.
position
(
)
将返回
distance
(
begin, match
[
i
]
.
first
)
。
这意味着 match [ i ] . position ( ) 给出的是从目标序列起始处的偏移量,该偏移量通常不同于调用 regex_search 时传入序列的偏移量。
具体实现如何进行这些调整是未指定的。这意味着编译器可能调用一个实现特定的搜索函数,在这种情况下,用户自定义的 regex_search 特化版本将不会被调用。
若迭代器为序列末尾迭代器,则行为未定义。
参数
(无)