Skip to content

Commit f02120f

Browse files
committed
[libc++] Implement P2417R2 (A more constexpr bitset)
Reviewed By: ldionne, #libc Spies: jloser, arichardson, libcxx-commits, arphaman Differential Revision: https://reviews.llvm.org/D131218
1 parent 7ae66e5 commit f02120f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1066
-619
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ Status
308308
------------------------------------------------- -----------------
309309
``__cpp_lib_byteswap`` ``202110L``
310310
------------------------------------------------- -----------------
311+
``__cpp_lib_constexpr_bitset`` ``202207L``
312+
------------------------------------------------- -----------------
311313
``__cpp_lib_constexpr_cmath`` *unimplemented*
312314
------------------------------------------------- -----------------
313315
``__cpp_lib_constexpr_typeinfo`` *unimplemented*

libcxx/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ What's New in Libc++ 16.0.0?
3838
Implemented Papers
3939
------------------
4040
- P2499R0 - ``string_view`` range constructor should be ``explicit``
41+
- P2417R2 - A more constexpr bitset
4142

4243
Improvements and New Features
4344
-----------------------------

libcxx/docs/Status/Cxx2bPapers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"`P2374R4 <https://wg21.link/P2374R4>`__","LWG","``views::cartesian_product``","July 2022","",""
7070
"`P2404R3 <https://wg21.link/P2404R3>`__","LWG","Move-only types for ``equality_comparable_with``, ``totally_ordered_with``, and ``three_way_comparable_with``","July 2022","",""
7171
"`P2408R5 <https://wg21.link/P2408R5>`__","LWG","Ranges iterators as inputs to non-Ranges algorithms","July 2022","",""
72-
"`P2417R2 <https://wg21.link/P2417R2>`__","LWG","A more ``constexpr`` ``bitset``","July 2022","",""
72+
"`P2417R2 <https://wg21.link/P2417R2>`__","LWG","A more ``constexpr`` ``bitset``","July 2022","|Complete|","16.0"
7373
"`P2419R2 <https://wg21.link/P2419R2>`__","LWG","Clarify handling of encodings in localized formatting of chrono types","July 2022","",""
7474
"`P2438R2 <https://wg21.link/P2438R2>`__","LWG","``std::string::substr() &&``","July 2022","",""
7575
"`P2445R1 <https://wg21.link/P2445R1>`__","LWG","``forward_like``","July 2022","",""

libcxx/include/__bit_reference

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last
263263
// count
264264

265265
template <class _Cp, bool _IsConst>
266-
_LIBCPP_HIDE_FROM_ABI typename __bit_iterator<_Cp, _IsConst>::difference_type
266+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 typename __bit_iterator<_Cp, _IsConst>::difference_type
267267
__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
268268
{
269269
typedef __bit_iterator<_Cp, _IsConst> _It;
@@ -1344,6 +1344,7 @@ private:
13441344
_LIBCPP_CONSTEXPR_AFTER_CXX17
13451345
friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
13461346
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
1347+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20
13471348
__count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
13481349
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
13491350
__count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);

libcxx/include/__config

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
156156
# endif
157157

158-
# define _LIBCPP_TOSTRING2(x) # x
158+
# define _LIBCPP_TOSTRING2(x) #x
159159
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
160160

161161
# if __cplusplus < 201103L
@@ -842,6 +842,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
842842
# define _LIBCPP_CONSTEXPR_AFTER_CXX17
843843
# endif
844844

845+
# if _LIBCPP_STD_VER > 20
846+
# define _LIBCPP_CONSTEXPR_AFTER_CXX20 constexpr
847+
# else
848+
# define _LIBCPP_CONSTEXPR_AFTER_CXX20
849+
# endif
850+
845851
# if __has_cpp_attribute(nodiscard)
846852
# define _LIBCPP_NODISCARD [[nodiscard]]
847853
# else

0 commit comments

Comments
 (0)