diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-08-13 13:52:35 +0200 |
---|---|---|
committer | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-08-14 10:34:01 +0200 |
commit | f02120fba28f2352fd9396683892fc6671caa137 (patch) | |
tree | 351b38337ac2a0c8e9d76f2ef4c70b831a46b390 /libcxx/include/bitset | |
parent | 7ae66e5e9593f0bc470b5796d50c5b8979f62665 (diff) | |
download | llvm-f02120fba28f2352fd9396683892fc6671caa137.zip llvm-f02120fba28f2352fd9396683892fc6671caa137.tar.gz llvm-f02120fba28f2352fd9396683892fc6671caa137.tar.bz2 |
[libc++] Implement P2417R2 (A more constexpr bitset)
Reviewed By: ldionne, #libc
Spies: jloser, arichardson, libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D131218
Diffstat (limited to 'libcxx/include/bitset')
-rw-r--r-- | libcxx/include/bitset | 270 |
1 files changed, 155 insertions, 115 deletions
diff --git a/libcxx/include/bitset b/libcxx/include/bitset index 67760a7..ea6ced6 100644 --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -42,61 +42,61 @@ public: template <class charT> explicit bitset(const charT* str, typename basic_string<charT>::size_type n = basic_string<charT>::npos, - charT zero = charT('0'), charT one = charT('1')); + charT zero = charT('0'), charT one = charT('1')); // constexpr since C++23 template<class charT, class traits, class Allocator> explicit bitset(const basic_string<charT,traits,Allocator>& str, typename basic_string<charT,traits,Allocator>::size_type pos = 0, typename basic_string<charT,traits,Allocator>::size_type n = basic_string<charT,traits,Allocator>::npos, - charT zero = charT('0'), charT one = charT('1')); + charT zero = charT('0'), charT one = charT('1')); // constexpr since C++23 // 23.3.5.2 bitset operations: - bitset& operator&=(const bitset& rhs) noexcept; - bitset& operator|=(const bitset& rhs) noexcept; - bitset& operator^=(const bitset& rhs) noexcept; - bitset& operator<<=(size_t pos) noexcept; - bitset& operator>>=(size_t pos) noexcept; - bitset& set() noexcept; - bitset& set(size_t pos, bool val = true); - bitset& reset() noexcept; - bitset& reset(size_t pos); - bitset operator~() const noexcept; - bitset& flip() noexcept; - bitset& flip(size_t pos); + bitset& operator&=(const bitset& rhs) noexcept; // constexpr since C++23 + bitset& operator|=(const bitset& rhs) noexcept; // constexpr since C++23 + bitset& operator^=(const bitset& rhs) noexcept; // constexpr since C++23 + bitset& operator<<=(size_t pos) noexcept; // constexpr since C++23 + bitset& operator>>=(size_t pos) noexcept; // constexpr since C++23 + bitset& set() noexcept; // constexpr since C++23 + bitset& set(size_t pos, bool val = true); // constexpr since C++23 + bitset& reset() noexcept; // constexpr since C++23 + bitset& reset(size_t pos); // constexpr since C++23 + bitset operator~() const noexcept; // constexpr since C++23 + bitset& flip() noexcept; // constexpr since C++23 + bitset& flip(size_t pos); // constexpr since C++23 // element access: - constexpr bool operator[](size_t pos) const; // for b[i]; - reference operator[](size_t pos); // for b[i]; - unsigned long to_ulong() const; - unsigned long long to_ullong() const; - template <class charT, class traits, class Allocator> + constexpr bool operator[](size_t pos) const; + reference operator[](size_t pos); // constexpr since C++23 + unsigned long to_ulong() const; // constexpr since C++23 + unsigned long long to_ullong() const; // constexpr since C++23 + template <class charT, class traits, class Allocator> // constexpr since C++23 basic_string<charT, traits, Allocator> to_string(charT zero = charT('0'), charT one = charT('1')) const; - template <class charT, class traits> + template <class charT, class traits> // constexpr since C++23 basic_string<charT, traits, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const; - template <class charT> + template <class charT> // constexpr since C++23 basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const; - basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const; - size_t count() const noexcept; - constexpr size_t size() const noexcept; - bool operator==(const bitset& rhs) const noexcept; - bool operator!=(const bitset& rhs) const noexcept; - bool test(size_t pos) const; - bool all() const noexcept; - bool any() const noexcept; - bool none() const noexcept; - bitset operator<<(size_t pos) const noexcept; - bitset operator>>(size_t pos) const noexcept; + basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const; // constexpr since C++23 + size_t count() const noexcept; // constexpr since C++23 + constexpr size_t size() const noexcept; // constexpr since C++23 + bool operator==(const bitset& rhs) const noexcept; // constexpr since C++23 + bool operator!=(const bitset& rhs) const noexcept; // constexpr since C++23 + bool test(size_t pos) const; // constexpr since C++23 + bool all() const noexcept; // constexpr since C++23 + bool any() const noexcept; // constexpr since C++23 + bool none() const noexcept; // constexpr since C++23 + bitset<N> operator<<(size_t pos) const noexcept; // constexpr since C++23 + bitset<N> operator>>(size_t pos) const noexcept; // constexpr since C++23 }; // 23.3.5.3 bitset operators: template <size_t N> -bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept; +bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept; // constexpr since C++23 template <size_t N> -bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept; +bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept; // constexpr since C++23 template <size_t N> -bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept; +bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept; // constexpr since C++23 template <class charT, class traits, size_t N> basic_istream<charT, traits>& @@ -178,30 +178,30 @@ protected: _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 reference __make_ref(size_t __pos) _NOEXCEPT {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} - _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 iterator __make_iter(size_t __pos) _NOEXCEPT {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} - _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 const_iterator __make_iter(size_t __pos) const _NOEXCEPT {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void operator&=(const __bitset& __v) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void operator|=(const __bitset& __v) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void operator^=(const __bitset& __v) _NOEXCEPT; - void flip() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 void flip() _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long to_ulong() const {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());} - _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long to_ullong() const {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());} - bool all() const _NOEXCEPT; - bool any() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool all() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool any() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT; private: @@ -210,14 +210,17 @@ private: _LIBCPP_INLINE_VISIBILITY void __init(unsigned long long __v, true_type) _NOEXCEPT; #endif // _LIBCPP_CXX03_LANG + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long to_ulong(false_type) const; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long to_ulong(true_type) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long to_ullong(false_type) const; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long to_ullong(true_type) const; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long to_ullong(true_type, false_type) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long to_ullong(true_type, true_type) const; }; @@ -290,7 +293,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT template <size_t _N_words, size_t _Size> inline -void +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 void __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT { for (size_type __i = 0; __i < _N_words; ++__i) @@ -299,7 +302,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT template <size_t _N_words, size_t _Size> inline -void +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 void __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT { for (size_type __i = 0; __i < _N_words; ++__i) @@ -308,7 +311,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT template <size_t _N_words, size_t _Size> inline -void +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 void __bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT { for (size_type __i = 0; __i < _N_words; ++__i) @@ -316,7 +319,7 @@ __bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT } template <size_t _N_words, size_t _Size> -void +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 void __bitset<_N_words, _Size>::flip() _NOEXCEPT { // do middle whole words @@ -335,7 +338,7 @@ __bitset<_N_words, _Size>::flip() _NOEXCEPT } template <size_t _N_words, size_t _Size> -unsigned long +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long __bitset<_N_words, _Size>::to_ulong(false_type) const { const_iterator __e = __make_iter(_Size); @@ -348,14 +351,14 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const template <size_t _N_words, size_t _Size> inline -unsigned long +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long __bitset<_N_words, _Size>::to_ulong(true_type) const { return __first_[0]; } template <size_t _N_words, size_t _Size> -unsigned long long +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long __bitset<_N_words, _Size>::to_ullong(false_type) const { const_iterator __e = __make_iter(_Size); @@ -368,7 +371,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const template <size_t _N_words, size_t _Size> inline -unsigned long long +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type) const { return to_ullong(true_type(), integral_constant<bool, sizeof(__storage_type) < sizeof(unsigned long long)>()); @@ -376,14 +379,14 @@ __bitset<_N_words, _Size>::to_ullong(true_type) const template <size_t _N_words, size_t _Size> inline -unsigned long long +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type, false_type) const { return __first_[0]; } template <size_t _N_words, size_t _Size> -unsigned long long +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const { unsigned long long __r = __first_[0]; @@ -393,7 +396,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const } template <size_t _N_words, size_t _Size> -bool +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool __bitset<_N_words, _Size>::all() const _NOEXCEPT { // do middle whole words @@ -413,7 +416,7 @@ __bitset<_N_words, _Size>::all() const _NOEXCEPT } template <size_t _N_words, size_t _Size> -bool +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool __bitset<_N_words, _Size>::any() const _NOEXCEPT { // do middle whole words @@ -474,33 +477,33 @@ protected: _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 reference __make_ref(size_t __pos) _NOEXCEPT {return reference(&__first_, __storage_type(1) << __pos);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT {return const_reference(&__first_, __storage_type(1) << __pos);} - _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 iterator __make_iter(size_t __pos) _NOEXCEPT {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} - _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 const_iterator __make_iter(size_t __pos) const _NOEXCEPT {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void operator&=(const __bitset& __v) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void operator|=(const __bitset& __v) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void operator^=(const __bitset& __v) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void flip() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long to_ulong() const; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long to_ullong() const; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bool all() const _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bool any() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY @@ -528,7 +531,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT template <size_t _Size> inline -void +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 void __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT { __first_ &= __v.__first_; @@ -536,7 +539,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT template <size_t _Size> inline -void +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 void __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT { __first_ |= __v.__first_; @@ -544,7 +547,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT template <size_t _Size> inline -void +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 void __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT { __first_ ^= __v.__first_; @@ -552,7 +555,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT template <size_t _Size> inline -void +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 void __bitset<1, _Size>::flip() _NOEXCEPT { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); @@ -562,7 +565,7 @@ __bitset<1, _Size>::flip() _NOEXCEPT template <size_t _Size> inline -unsigned long +_LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long __bitset<1, _Size>::to_ulong() const { return __first_; @@ -570,7 +573,7 @@ __bitset<1, _Size>::to_ulong() const template <size_t _Size> inline -unsigned long long +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long __bitset<1, _Size>::to_ullong() const { return __first_; @@ -578,7 +581,7 @@ __bitset<1, _Size>::to_ullong() const template <size_t _Size> inline -bool +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool __bitset<1, _Size>::all() const _NOEXCEPT { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); @@ -587,7 +590,7 @@ __bitset<1, _Size>::all() const _NOEXCEPT template <size_t _Size> inline -bool +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool __bitset<1, _Size>::any() const _NOEXCEPT { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); @@ -631,26 +634,26 @@ protected: _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 reference __make_ref(size_t) _NOEXCEPT {return reference(nullptr, 1);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT {return const_reference(nullptr, 1);} - _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 iterator __make_iter(size_t) _NOEXCEPT {return iterator(nullptr, 0);} - _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 const_iterator __make_iter(size_t) const _NOEXCEPT {return const_iterator(nullptr, 0);} - _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void operator&=(const __bitset&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void operator|=(const __bitset&) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void operator^=(const __bitset&) _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 void flip() _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;} - _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long to_ulong() const {return 0;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long to_ullong() const {return 0;} - _LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT {return true;} - _LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT {return false;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bool all() const _NOEXCEPT {return true;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bool any() const _NOEXCEPT {return false;} _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;} }; @@ -687,10 +690,12 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset(unsigned long long __v) _NOEXCEPT : base(__v) {} template<class _CharT, class = __enable_if_t<_IsCharLikeType<_CharT>::value> > + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 explicit bitset(const _CharT* __str, typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); template<class _CharT, class _Traits, class _Allocator> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0, typename basic_string<_CharT,_Traits,_Allocator>::size_type __n = @@ -698,24 +703,29 @@ public: _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); // 23.3.5.2 bitset operations: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& operator&=(const bitset& __rhs) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& operator|=(const bitset& __rhs) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& operator^=(const bitset& __rhs) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& operator<<=(size_t __pos) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& operator>>=(size_t __pos) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& set() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& set(size_t __pos, bool __val = true); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& reset() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& reset(size_t __pos); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset operator~() const _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& flip() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset& flip(size_t __pos); // element access: @@ -724,41 +734,43 @@ public: #else _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const {return base::__make_ref(__p);} #endif - _LIBCPP_HIDE_FROM_ABI reference operator[](size_t __p) {return base::__make_ref(__p);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 reference operator[](size_t __p) {return base::__make_ref(__p);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long to_ulong() const; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long to_ullong() const; template <class _CharT, class _Traits, class _Allocator> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; template <class _CharT, class _Traits> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; template <class _CharT> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0', char __one = '1') const; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 size_t count() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bool operator==(const bitset& __rhs) const _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bool operator!=(const bitset& __rhs) const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool test(size_t __pos) const; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bool all() const _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bool any() const _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bool none() const _NOEXCEPT {return !any();} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset operator<<(size_t __pos) const _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset operator>>(size_t __pos) const _NOEXCEPT; private: @@ -771,6 +783,7 @@ private: template <size_t _Size> template<class _CharT, class> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>::bitset(const _CharT* __str, typename basic_string<_CharT>::size_type __n, _CharT __zero, _CharT __one) @@ -792,6 +805,7 @@ bitset<_Size>::bitset(const _CharT* __str, template <size_t _Size> template<class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos, typename basic_string<_CharT,_Traits,_Allocator>::size_type __n, @@ -817,6 +831,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT { @@ -826,6 +841,7 @@ bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT { @@ -835,6 +851,7 @@ bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT { @@ -843,6 +860,7 @@ bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT } template <size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT { @@ -853,6 +871,7 @@ bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT } template <size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT { @@ -864,6 +883,7 @@ bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::set() _NOEXCEPT { @@ -872,6 +892,7 @@ bitset<_Size>::set() _NOEXCEPT } template <size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::set(size_t __pos, bool __val) { @@ -884,6 +905,7 @@ bitset<_Size>::set(size_t __pos, bool __val) template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::reset() _NOEXCEPT { @@ -892,6 +914,7 @@ bitset<_Size>::reset() _NOEXCEPT } template <size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::reset(size_t __pos) { @@ -904,6 +927,7 @@ bitset<_Size>::reset(size_t __pos) template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size> bitset<_Size>::operator~() const _NOEXCEPT { @@ -914,6 +938,7 @@ bitset<_Size>::operator~() const _NOEXCEPT template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::flip() _NOEXCEPT { @@ -922,6 +947,7 @@ bitset<_Size>::flip() _NOEXCEPT } template <size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size>& bitset<_Size>::flip(size_t __pos) { @@ -935,6 +961,7 @@ bitset<_Size>::flip(size_t __pos) template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long bitset<_Size>::to_ulong() const { @@ -943,6 +970,7 @@ bitset<_Size>::to_ulong() const template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 unsigned long long bitset<_Size>::to_ullong() const { @@ -951,6 +979,7 @@ bitset<_Size>::to_ullong() const template <size_t _Size> template <class _CharT, class _Traits, class _Allocator> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 basic_string<_CharT, _Traits, _Allocator> bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { @@ -966,6 +995,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const template <size_t _Size> template <class _CharT, class _Traits> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 basic_string<_CharT, _Traits, allocator<_CharT> > bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { @@ -975,6 +1005,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const template <size_t _Size> template <class _CharT> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { @@ -983,6 +1014,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 basic_string<char, char_traits<char>, allocator<char> > bitset<_Size>::to_string(char __zero, char __one) const { @@ -991,6 +1023,7 @@ bitset<_Size>::to_string(char __zero, char __one) const template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 size_t bitset<_Size>::count() const _NOEXCEPT { @@ -999,6 +1032,7 @@ bitset<_Size>::count() const _NOEXCEPT template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT { @@ -1007,6 +1041,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT { @@ -1014,6 +1049,7 @@ bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT } template <size_t _Size> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool bitset<_Size>::test(size_t __pos) const { @@ -1025,6 +1061,7 @@ bitset<_Size>::test(size_t __pos) const template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool bitset<_Size>::all() const _NOEXCEPT { @@ -1033,6 +1070,7 @@ bitset<_Size>::all() const _NOEXCEPT template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bool bitset<_Size>::any() const _NOEXCEPT { @@ -1041,6 +1079,7 @@ bitset<_Size>::any() const _NOEXCEPT template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size> bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT { @@ -1051,6 +1090,7 @@ bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT template <size_t _Size> inline +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size> bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT { @@ -1060,7 +1100,7 @@ bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size> operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT { @@ -1070,7 +1110,7 @@ operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size> operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT { @@ -1080,7 +1120,7 @@ operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX20 bitset<_Size> operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT { |