diff options
author | timshen <timshen@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-26 19:45:15 +0000 |
---|---|---|
committer | timshen <timshen@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-26 19:45:15 +0000 |
commit | e92400748dd016b621b55905a1ad9cc5e10331e4 (patch) | |
tree | 46a4b83ab67df5459975d8f47c6a5dc6f1a9001e /libstdc++-v3/include/bits/regex.tcc | |
parent | e5a3303f90fcbcba4d8cd9cdcc0a2c7f45958b25 (diff) | |
download | ppe42-gcc-e92400748dd016b621b55905a1ad9cc5e10331e4.tar.gz ppe42-gcc-e92400748dd016b621b55905a1ad9cc5e10331e4.zip |
2014-02-26 Tim Shen <timshen91@gmail.com>
* include/bits/regex.tcc (match_results<>::format,
regex_replace<>): Update __out after calling std::copy.
* testsuite/28_regex/algorithms/regex_replace/char/dr2213.cc:
Add testcase.
* testsuite/28_regex/match_results/format.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208179 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/regex.tcc')
-rw-r--r-- | libstdc++-v3/include/bits/regex.tcc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc index 73f55dfc5f6..5fa1f018b3d 100644 --- a/libstdc++-v3/include/bits/regex.tcc +++ b/libstdc++-v3/include/bits/regex.tcc @@ -425,7 +425,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { auto& __sub = _Base_type::operator[](__idx); if (__sub.matched) - std::copy(__sub.first, __sub.second, __out); + __out = std::copy(__sub.first, __sub.second, __out); }; if (__flags & regex_constants::format_sed) @@ -455,7 +455,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__next == __fmt_last) break; - std::copy(__fmt_first, __next, __out); + __out = std::copy(__fmt_first, __next, __out); auto __eat = [&](char __ch) -> bool { @@ -493,7 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION *__out++ = '$'; __fmt_first = __next; } - std::copy(__fmt_first, __fmt_last, __out); + __out = std::copy(__fmt_first, __fmt_last, __out); } return __out; } @@ -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 { @@ -521,14 +521,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION for (; __i != __end; ++__i) { if (!(__flags & regex_constants::format_no_copy)) - std::copy(__i->prefix().first, __i->prefix().second, __out); + __out = std::copy(__i->prefix().first, __i->prefix().second, + __out); __out = __i->format(__out, __fmt, __fmt + __len, __flags); __last = __i->suffix(); if (__flags & regex_constants::format_first_only) 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; } |