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.

682. basic_regex ctor takes InputIterator or ForwardIterator?

Section: 32.7.2 [re.regex.construct] Status: CD1 Submitter: Eric Niebler Opened: 2007-06-03 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [re.regex.construct].

View all other issues in [re.regex.construct].

View all issues with CD1 status.

Discussion:

Looking at N2284, 32.7 [re.regex], p3 basic_regex class template synopsis shows this constructor:

template <class InputIterator>
     basic_regex(InputIterator first, InputIterator last, 
                 flag_type f = regex_constants::ECMAScript);

In 32.7.2 [re.regex.construct], p15, the constructor appears with this signature:

template <class ForwardIterator>
     basic_regex(ForwardIterator first, ForwardIterator last, 
                 flag_type f = regex_constants::ECMAScript);

ForwardIterator is probably correct, so the synopsis is wrong.

[ John adds: ]

I think either could be implemented? Although an input iterator would probably require an internal copy of the string being made.

I have no strong feelings either way, although I think my original intent was InputIterator.

Proposed resolution:

Adopt the proposed resolution in N2409.

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