diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-04-04 20:28:59 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-04-05 11:37:19 +0100 |
commit | 44e17b8d8999a658af9f86681504d74a119a5f6f (patch) | |
tree | 602bcfcfe3848a3a61bdbfe1163cfc7883037273 /libstdc++-v3/include/bits/regex.h | |
parent | fdc5abbdcfb65d415af6c40230f8f07872e51e49 (diff) | |
download | gcc-44e17b8d8999a658af9f86681504d74a119a5f6f.tar.gz |
libstdc++: Define std::sub_match::swap member function (LWG 3204)
This was approved at the C++ meeting in February.
libstdc++-v3/ChangeLog:
* include/bits/regex.h (sub_match::swap): New function.
* testsuite/28_regex/sub_match/lwg3204.cc: New test.
Diffstat (limited to 'libstdc++-v3/include/bits/regex.h')
-rw-r--r-- | libstdc++-v3/include/bits/regex.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 79903fad1e5..26ac6a21c31 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -1006,6 +1006,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { return this->_M_str().compare({__s, __n}); } /// @endcond + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3204. sub_match::swap only swaps the base class + /// Swap the values of two sub_match objects. + void + swap(sub_match& __s) noexcept(__is_nothrow_swappable<_BiIter>::value) + { + this->pair<_BiIter, _BiIter>::swap(__s); + std::swap(matched, __s.matched); + } + private: // Simplified basic_string_view for C++11 struct __string_view |