Skip to content

[LWG motion 24] P2697R1 Interfacing bitset with string_view #6346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
26 changes: 21 additions & 5 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9687,10 +9687,18 @@
= basic_string<charT, traits, Allocator>::npos,
charT zero = charT('0'),
charT one = charT('1'));
template<class charT, class traits>
constexpr explicit bitset(
basic_string_view<charT, traits> str,
typename basic_string_view<charT, traits>::size_type pos = 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use std::size_t directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question for the authors...

typename basic_string_view<charT, traits>::size_type n
= basic_string_view<charT, traits>::npos,
charT zero = charT('0'),
charT one = charT('1'));
template<class charT>
constexpr explicit bitset(
const charT* str,
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
typename basic_string_view<charT>::size_type n = basic_string_view<charT>::npos,
charT zero = charT('0'),
charT one = charT('1'));

Expand Down Expand Up @@ -9823,6 +9831,14 @@
= basic_string<charT, traits, Allocator>::npos,
charT zero = charT('0'),
charT one = charT('1'));
template<class charT, class traits>
constexpr explicit bitset(
basic_string_view<charT, traits> str,
typename basic_string_view<charT, traits>::size_type pos = 0,
typename basic_string_view<charT, traits>::size_type n
= basic_string_view<charT, traits>::npos,
charT zero = charT('0'),
charT one = charT('1'));
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -9869,7 +9885,7 @@
template<class charT>
constexpr explicit bitset(
const charT* str,
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
typename basic_string_view<charT>::size_type n = basic_string_view<charT>::npos,
charT zero = charT('0'),
charT one = charT('1'));
\end{itemdecl}
Expand All @@ -9879,9 +9895,9 @@
\effects
As if by:
\begin{codeblock}
bitset(n == basic_string<charT>::npos
? basic_string<charT>(str)
: basic_string<charT>(str, n),
bitset(n == basic_string_view<charT>::npos
? basic_string_view<charT>(str)
: basic_string_view<charT>(str, n),
0, n, zero, one)
\end{codeblock}
\end{itemdescr}
Expand Down