regex_token_iterator
constructor uses wrong pointer arithmeticSection: 28.6.11.2.2 [re.tokiter.cnstr] Status: C++20 Submitter: Tim Song Opened: 2018-06-30 Last modified: 2021-02-25
Priority: 0
View all other issues in [re.tokiter.cnstr].
View all issues with C++20 status.
Discussion:
The specification of regex_token_iterator
for the overload taking a
const int (&submatchs)[N]
uses the range [&submatches, &submatches + N)
.
This is obviously incorrect; we want to perform pointer arithmetic on a pointer to the first element
of that array, not a pointer to the whole array.
[2018-07-20 Status to Tentatively Ready after five positive votes on the reflector.]
[2018-11, Adopted in San Diego]
Proposed resolution:
This wording is relative to N4750.
Change 28.6.11.2.2 [re.tokiter.cnstr] p3 as indicated:
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default); regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const vector<int>& submatches, regex_constants::match_flag_type m = regex_constants::match_default); regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, initializer_list<int> submatches, regex_constants::match_flag_type m = regex_constants::match_default); template<size_t N> regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const int (&submatches)[N], regex_constants::match_flag_type m = regex_constants::match_default);-2- Requires: […]
-3- Effects: The first constructor initializes the membersubs
to hold the single valuesubmatch
.The second constructor initializes the memberThe second, third and fourth constructors initialize the membersubs
to hold a copy of the argumentsubmatches
.subs
to hold a copy of the sequence of integer values pointed to by the iterator range[submatches.begin(), submatches.end())
and[&submatches, &submatches + N)
, respectively[begin(submatches), end(submatches))
. -4- […]