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

647. Inconsistent regex_search params

Section: 32.10.3 [re.alg.search] Status: NAD Editorial Submitter: Daniel Krügler Opened: 2007-02-26 Last modified: 2016-01-28

Priority: Not Prioritized

View all issues with NAD Editorial status.

Discussion:

32.10.3 [re.alg.search]/5 declares

template <class iterator, class charT, class traits>
bool regex_search(iterator first, iterator last,
                  const basic_regex<charT, traits>& e,
                  regex_constants::match_flag_type flags =
                      regex_constants::match_default);

where it's not explained, which iterator category the parameter iterator belongs to. This is inconsistent to the preceding declaration in the synopsis section 32.3 [re.syn], which says:

template <class BidirectionalIterator, class charT, class traits>
bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
                  const basic_regex<charT, traits>& e,
                  regex_constants::match_flag_type flags =
                      regex_constants::match_default);

Proposed resolution:

In 32.10.3 [re.alg.search]/5 replace all three occurences of param "iterator" with "BidirectionalIterator"

template <class iterator BidirectionalIterator, class charT, class traits>
  bool regex_search(iterator BidirectionalIterator first, iterator BidirectionalIterator last, 
                    const basic_regex<charT, traits>& e, 
                    regex_constants::match_flag_type flags = 
                      regex_constants::match_default);

-6- Effects: Behaves "as if" by constructing an object what of type match_results<iterator BidirectionalIterator> and then returning the result of regex_search(first, last, what, e, flags).

Rationale:

Applied to working paper while issue was still in New status.