Title
regex_replace(basic_string) allocator handling
Status
new
Section
[re.alg.replace]
Submitter
Jeffrey Yasskin

Created on 2012-11-26.00:00:00 last changed 138 months ago

Messages

Date: 2012-11-26.00:00:00
template <class traits, class charT, class ST, class SA>
  basic_string<charT, ST, SA>
  regex_replace(const basic_string<charT, ST, SA>& s,
      const basic_regex<charT, traits>& e,
      const charT* fmt,
      regex_constants::match_flag_type flags = 
	    regex_constants::match_default);

and friends are documented as

Constructs an empty string result of type basic_string<charT, ST, SA> and calls regex_replace(back_inserter(result), s.begin(), s.end(), e, fmt, flags).

This appears to require the result to have a default-constructed allocator, which isn't even possible for all allocator types. I suspect the allocator should be copied from 's' instead. Possibly there should be an additional defaulted argument to override the allocator of the result.

History
Date User Action Args
2012-11-26 00:00:00admincreate