On Wed, Jul 16, 2025 at 12:07 PM Jonathan Wakely <jwak...@redhat.com> wrote:

> This change was part of by P2697R1 (Interfacing bitset with string_view)
> and should be slightly cheaper to instantiate.
>
> libstdc++-v3/ChangeLog:
>
>         * include/std/bitset (__bitset::__string) [__cpp_lib_bitset]:
>         Change alias to refer to basic_string_view instead.
> ---
>
> Tested x86_64-linux.
>
>  libstdc++-v3/include/std/bitset | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/std/bitset
> b/libstdc++-v3/include/std/bitset
> index 61756350cc9c..92f11f19807a 100644
> --- a/libstdc++-v3/include/std/bitset
> +++ b/libstdc++-v3/include/std/bitset
> @@ -720,7 +720,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
>
>    namespace __bitset
>    {
> -#if _GLIBCXX_HOSTED
> +#ifdef __cpp_lib_bitset // ...construct from string_view
>
Could we change this condition to  __glibcxx_string_view, i.e. use
string_view
when it does exist?
Or are we concerned about the possible change of signature of the
constructor,
and using a different specialization of _M_copy_from_ptr in C++17 mode?

> +    template<typename _CharT>
> +      using __string = std::basic_string_view<_CharT>;
> +#elif _GLIBCXX_HOSTED
>      template<typename _CharT>
>        using __string = std::basic_string<_CharT>;
>  #else
> --
> 2.50.1
>
>

Reply via email to