From af899687a996634d53ac19f1b48636f685e4fd4c Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Fri, 23 Jun 2023 12:56:43 -0700 Subject: [PATCH] P2697R1 Interfacing bitset with string_view --- source/support.tex | 1 + source/utilities.tex | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/source/support.tex b/source/support.tex index 04072f868d..87b4bec74a 100644 --- a/source/support.tex +++ b/source/support.tex @@ -580,6 +580,7 @@ #define @\defnlibxname{cpp_lib_bind_front}@ 201907L // freestanding, also in \libheader{functional} #define @\defnlibxname{cpp_lib_bit_cast}@ 201806L // freestanding, also in \libheader{bit} #define @\defnlibxname{cpp_lib_bitops}@ 201907L // freestanding, also in \libheader{bit} +#define @\defnlibxname{cpp_lib_bitset}@ 202306L // also in \libheader{bitset} #define @\defnlibxname{cpp_lib_bool_constant}@ 201505L // freestanding, also in \libheader{type_traits} #define @\defnlibxname{cpp_lib_bounded_array_traits}@ 201902L // freestanding, also in \libheader{type_traits} #define @\defnlibxname{cpp_lib_boyer_moore_searcher}@ 201603L // also in \libheader{functional} diff --git a/source/utilities.tex b/source/utilities.tex index 2ffd9bdfca..9bc7a9a8a4 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -9687,10 +9687,18 @@ = basic_string::npos, charT zero = charT('0'), charT one = charT('1')); + template + constexpr explicit bitset( + basic_string_view str, + typename basic_string_view::size_type pos = 0, + typename basic_string_view::size_type n + = basic_string_view::npos, + charT zero = charT('0'), + charT one = charT('1')); template constexpr explicit bitset( const charT* str, - typename basic_string::size_type n = basic_string::npos, + typename basic_string_view::size_type n = basic_string_view::npos, charT zero = charT('0'), charT one = charT('1')); @@ -9823,6 +9831,14 @@ = basic_string::npos, charT zero = charT('0'), charT one = charT('1')); +template + constexpr explicit bitset( + basic_string_view str, + typename basic_string_view::size_type pos = 0, + typename basic_string_view::size_type n + = basic_string_view::npos, + charT zero = charT('0'), + charT one = charT('1')); \end{itemdecl} \begin{itemdescr} @@ -9869,7 +9885,7 @@ template constexpr explicit bitset( const charT* str, - typename basic_string::size_type n = basic_string::npos, + typename basic_string_view::size_type n = basic_string_view::npos, charT zero = charT('0'), charT one = charT('1')); \end{itemdecl} @@ -9879,9 +9895,9 @@ \effects As if by: \begin{codeblock} -bitset(n == basic_string::npos - ? basic_string(str) - : basic_string(str, n), +bitset(n == basic_string_view::npos + ? basic_string_view(str) + : basic_string_view(str, n), 0, n, zero, one) \end{codeblock} \end{itemdescr}