std::regex_replace behaviour (LWG DR 2213)
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Feb 13 18:13:00 GMT 2014
The LWG have decided that
http://cplusplus.github.io/LWG/lwg-active.html#2213 is a defect.
In our std::regex_replace we do not appear to update out in all places
that we should.
I think we want this:
--- a/libstdc++-v3/include/bits/regex.tcc
+++ b/libstdc++-v3/include/bits/regex.tcc
@@ -512,7 +512,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__i == __end)
{
if (!(__flags & regex_constants::format_no_copy))
- std::copy(__first, __last, __out);
+ __out = std::copy(__first, __last, __out);
}
else
{
@@ -528,7 +528,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
break;
}
if (!(__flags & regex_constants::format_no_copy))
- std::copy(__last.first, __last.second, __out);
+ __out = std::copy(__last.first, __last.second, __out);
}
return __out;
}
More information about the Libstdc++
mailing list