[PATCH v2] libstdc++: C++23, implement WG21 P1679R3

Jonathan Wakely jwakely@redhat.com
Wed Jan 27 12:39:58 GMT 2021


On 15/01/21 01:23 +0000, Paul Fee via Libstdc++ wrote:
>Add contains member function to basic_string_view and basic_string.
>
>The new method is enabled for -std=gnu++20, gnu++2b and c++2b.  This allows
>users to access the method as a GNU extension to C++20.  The conditional
>test may be reduced to "__cplusplus > 202011L" once GCC has a c++2b switch.
>
>Changes since v1 (13th Jan 2021)
>* New:
>  Test __cplusplus >= 202011L, rather than __cplusplus > 202011L.
>
>* As suggested by Jonathan Wakely:
>  Adjust formatting.
>  Test feature-test macro is defined by <string_view> and <version>.
>  Correct copyright dates on new files.
>  Fix comment typo.
>
>libstdc++-v3/
>
>    Add contains member function to basic_string_view.
>    Likewise to basic_string_view, both with and without _GLIBCXX_USE_CXX11_ABI.
>    Enabled with -std=gnu++20, gnu++2b and c++2b.
>    * include/bits/basic_string.h (basic_string::contains): New.
>    * libstdc++-v3/include/std/string_view (basic_string_view::contains): New.
>    * testsuite/21_strings/basic_string/operations/contains/char/1.cc: New test.
>    * testsuite/21_strings/basic_string/operations/contains/wchar_t/1.cc:
>New test.
>    * testsuite/21_strings/basic_string_view/operations/contains/char/1.cc:
>New test.
>    * testsuite/21_strings/basic_string_view/operations/contains/wchar_t/1.cc:
>New test.

I've committed this to master now.

Now that -std=gnu++23 is supported I changed the preprocessor
condition to just check __cplusplus > 201102L (and not enable it for
-std=gnu++20) and changed the tests to use 23 not 2b. I've attached
what I committed.

Thanks for your patch!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 16735 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210127/0f6527f4/attachment.bin>


More information about the Libstdc++ mailing list