This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.

### 651. Missing preconditions for regex_token_iterator c'tors

Section: 30.11.2.2 [re.tokiter.cnstr] Status: CD1 Submitter: Daniel Krügler Opened: 2007-03-05 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [re.tokiter.cnstr].

View all issues with CD1 status.

Discussion:

The text provided in 30.11.2.2 [re.tokiter.cnstr]/2+3 describes the effects of the three non-default constructors of class template regex_token_iterator but is does not clarify which values are legal values for submatch/submatches. This becomes an issue, if one takes 30.11.2 [re.tokiter]/9 into account, which explains the notion of a "current match" by saying:

> The current match is `(*position).prefix()` if `subs[N] == -1`, or `(*position)[subs[N]]` for any other value of `subs[N]`.

It's not clear to me, whether other negative values except -1 are legal arguments or not - it seems they are not.

Proposed resolution:

Add the following precondition paragraph just before the current 30.11.2.2 [re.tokiter.cnstr]/2:

> Requires: Each of the initialization values of `subs` must be `>= -1`.

[ Kona (2007): The LWG adopted the proposed resolution of N2409 for this issue (which is to adopt the proposed wording in this issue). The LWG voted to accelerate this issue to Ready status to be voted into the WP at Kona. ]