Title
basic_regex range constructor: Missing requirements for iterator types
Status
new
Section
[re.regex.construct]
Submitter
Денис Захаров

Created on 2019-11-17.00:00:00 last changed 31 months ago

Messages

Date: 2022-04-15.00:00:00

[ 2022-04-22; Jonathan adds a comment ]

As well as requiring the reference type to be convertible to charT, we might want to consider constraining these with forward_iterator as per P2408.

Date: 2021-10-15.00:00:00

[ 2021-10-04; Jonathan adds a comment ]

There isn't even a requirement that the arguments are iterators. And assign(InputIterator, InputIterator, flag_type) is not constrained to only accept iterators either, meaning you can call it with two integers and call the basic_string(size_type, char_type) constructor.

Date: 2019-11-30.00:00:00

[ 2019-11-30 Issue Prioritization ]

Priority to 3 after reflector discussion.

Date: 2019-11-17.00:00:00

This is description of a basic_regex range constructor from N4835, [re.regex.construct]:

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

-17- Throws: regex_error if the sequence [first, last) is not a valid regular expression.

-18- Effects: Constructs an object of class basic_regex; the object's internal finite state machine is constructed from the regular expression contained in the sequence of characters [first, last), and interpreted according to the flags specified in f.

-19- Ensures: flags() returns f. mark_count() returns the number of marked sub-expressions within the expression.

It seems that there are no requirements about dereferenced iterator's element type, that, apparently, must be implicitly convertible to the basic_regex::value_type. For example, containers having range constructor satisfy a SequenceContainer requirements, where implicit converting to its elements is specified.

History
Date User Action Args
2022-04-22 17:05:58adminsetmessages: + msg12421
2021-10-04 12:26:14adminsetmessages: + msg12102
2019-11-30 13:47:36adminsetmessages: + msg10852
2019-11-17 00:00:00admincreate