diff options
author | Louis Dionne <ldionne.2@gmail.com> | 2023-12-18 14:01:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-18 14:01:33 -0500 |
commit | 9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7 (patch) | |
tree | 4119e3edc01dd51cf2752b2a3341c34d8a3700ac /libcxx/include/bitset | |
parent | e5c523e8610492b3256dde6856811b527b4dcb35 (diff) | |
download | llvm-9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7.zip llvm-9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7.tar.gz llvm-9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7.tar.bz2 |
[libc++] Format the code base (#74334)
This patch runs clang-format on all of libcxx/include and libcxx/src, in
accordance with the RFC discussed at [1]. Follow-up patches will format
the benchmarks, the test suite and remaining parts of the code. I'm
splitting this one into its own patch so the diff is a bit easier to
review.
This patch was generated with:
find libcxx/include libcxx/src -type f \
| grep -v 'module.modulemap.in' \
| grep -v 'CMakeLists.txt' \
| grep -v 'README.txt' \
| grep -v 'libcxx.imp' \
| grep -v '__config_site.in' \
| xargs clang-format -i
A Git merge driver is available in libcxx/utils/clang-format-merge-driver.sh
to help resolve merge and rebase issues across these formatting changes.
[1]: https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all
Diffstat (limited to 'libcxx/include/bitset')
-rw-r--r-- | libcxx/include/bitset | 1290 |
1 files changed, 537 insertions, 753 deletions
diff --git a/libcxx/include/bitset b/libcxx/include/bitset index d33015d..308c589 100644 --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -154,1012 +154,796 @@ template <size_t N> struct hash<std::bitset<N>>; _LIBCPP_PUSH_MACROS #include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD template <size_t _N_words, size_t _Size> class __bitset; template <size_t _N_words, size_t _Size> -struct __has_storage_type<__bitset<_N_words, _Size> > -{ - static const bool value = true; +struct __has_storage_type<__bitset<_N_words, _Size> > { + static const bool value = true; }; template <size_t _N_words, size_t _Size> -class __bitset -{ +class __bitset { public: - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef size_type __storage_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef size_type __storage_type; + protected: - typedef __bitset __self; - typedef __storage_type* __storage_pointer; - typedef const __storage_type* __const_storage_pointer; - static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); - - friend class __bit_reference<__bitset>; - friend class __bit_const_reference<__bitset>; - friend class __bit_iterator<__bitset, false>; - friend class __bit_iterator<__bitset, true>; - friend struct __bit_array<__bitset>; - - __storage_type __first_[_N_words]; - - typedef __bit_reference<__bitset> reference; - typedef __bit_const_reference<__bitset> const_reference; - typedef __bit_iterator<__bitset, false> iterator; - typedef __bit_iterator<__bitset, true> const_iterator; - - _LIBCPP_HIDE_FROM_ABI - _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI - explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT - {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} - _LIBCPP_HIDE_FROM_ABI _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_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT - {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT - {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - void operator&=(const __bitset& __v) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - void operator|=(const __bitset& __v) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - void operator^=(const __bitset& __v) _NOEXCEPT; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const - {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const - {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());} - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI - size_t __hash_code() const _NOEXCEPT; + typedef __bitset __self; + typedef __storage_type* __storage_pointer; + typedef const __storage_type* __const_storage_pointer; + static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); + + friend class __bit_reference<__bitset>; + friend class __bit_const_reference<__bitset>; + friend class __bit_iterator<__bitset, false>; + friend class __bit_iterator<__bitset, true>; + friend struct __bit_array<__bitset>; + + __storage_type __first_[_N_words]; + + typedef __bit_reference<__bitset> reference; + typedef __bit_const_reference<__bitset> const_reference; + typedef __bit_iterator<__bitset, false> iterator; + typedef __bit_iterator<__bitset, true> const_iterator; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT { + return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word); + } + _LIBCPP_HIDE_FROM_ABI _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_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT { + return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT { + return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word); + } + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset& __v) _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const { + return to_ulong(integral_constant < bool, _Size< sizeof(unsigned long) * CHAR_BIT>()); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const { + return to_ullong(integral_constant < bool, _Size< sizeof(unsigned long long) * CHAR_BIT>()); + } + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT; + private: #ifdef _LIBCPP_CXX03_LANG - void __init(unsigned long long __v, false_type) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI - void __init(unsigned long long __v, true_type) _NOEXCEPT; + void __init(unsigned long long __v, false_type) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI void __init(unsigned long long __v, true_type) _NOEXCEPT; #endif // _LIBCPP_CXX03_LANG - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long to_ulong(false_type) const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long to_ulong(true_type) const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long long to_ullong(false_type) const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long long to_ullong(true_type) const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long long to_ullong(true_type, false_type) const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long long to_ullong(true_type, true_type) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong(false_type) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong(true_type) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(false_type) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(true_type) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(true_type, false_type) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong(true_type, true_type) const; }; template <size_t _N_words, size_t _Size> -inline -_LIBCPP_CONSTEXPR -__bitset<_N_words, _Size>::__bitset() _NOEXCEPT +inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT #ifndef _LIBCPP_CXX03_LANG : __first_{0} #endif { #ifdef _LIBCPP_CXX03_LANG - std::fill_n(__first_, _N_words, __storage_type(0)); + std::fill_n(__first_, _N_words, __storage_type(0)); #endif } #ifdef _LIBCPP_CXX03_LANG template <size_t _N_words, size_t _Size> -void -__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT -{ - __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)]; - size_t __sz = _Size; - for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word, __sz -= __bits_per_word ) - if ( __sz < __bits_per_word) - __t[__i] = static_cast<__storage_type>(__v) & ( 1ULL << __sz ) - 1; - else - __t[__i] = static_cast<__storage_type>(__v); - - std::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_); - std::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]), - __storage_type(0)); +void __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT { + __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)]; + size_t __sz = _Size; + for (size_t __i = 0; __i < sizeof(__t) / sizeof(__t[0]); ++__i, __v >>= __bits_per_word, __sz -= __bits_per_word) + if (__sz < __bits_per_word) + __t[__i] = static_cast<__storage_type>(__v) & (1ULL << __sz) - 1; + else + __t[__i] = static_cast<__storage_type>(__v); + + std::copy(__t, __t + sizeof(__t) / sizeof(__t[0]), __first_); + std::fill( + __first_ + sizeof(__t) / sizeof(__t[0]), __first_ + sizeof(__first_) / sizeof(__first_[0]), __storage_type(0)); } template <size_t _N_words, size_t _Size> -inline _LIBCPP_HIDE_FROM_ABI -void -__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT -{ - __first_[0] = __v; - if (_Size < __bits_per_word) - __first_[0] &= ( 1ULL << _Size ) - 1; +inline _LIBCPP_HIDE_FROM_ABI void __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT { + __first_[0] = __v; + if (_Size < __bits_per_word) + __first_[0] &= (1ULL << _Size) - 1; - std::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0)); + std::fill(__first_ + 1, __first_ + sizeof(__first_) / sizeof(__first_[0]), __storage_type(0)); } #endif // _LIBCPP_CXX03_LANG template <size_t _N_words, size_t _Size> -inline -_LIBCPP_CONSTEXPR -__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT +inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT #ifndef _LIBCPP_CXX03_LANG -#if __SIZEOF_SIZE_T__ == 8 +# if __SIZEOF_SIZE_T__ == 8 : __first_{__v} -#elif __SIZEOF_SIZE_T__ == 4 +# elif __SIZEOF_SIZE_T__ == 4 : __first_{static_cast<__storage_type>(__v), - _Size >= 2 * __bits_per_word ? static_cast<__storage_type>(__v >> __bits_per_word) - : static_cast<__storage_type>((__v >> __bits_per_word) & (__storage_type(1) << (_Size - __bits_per_word)) - 1)} -#else -#error This constructor has not been ported to this platform -#endif + _Size >= 2 * __bits_per_word + ? static_cast<__storage_type>(__v >> __bits_per_word) + : static_cast<__storage_type>((__v >> __bits_per_word) & + (__storage_type(1) << (_Size - __bits_per_word)) - 1)} +# else +# error This constructor has not been ported to this platform +# endif #endif { #ifdef _LIBCPP_CXX03_LANG - __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>()); + __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>()); #endif } template <size_t _N_words, size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void -__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT -{ - for (size_type __i = 0; __i < _N_words; ++__i) - __first_[__i] &= __v.__first_[__i]; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void +__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT { + for (size_type __i = 0; __i < _N_words; ++__i) + __first_[__i] &= __v.__first_[__i]; } template <size_t _N_words, size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void -__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT -{ - for (size_type __i = 0; __i < _N_words; ++__i) - __first_[__i] |= __v.__first_[__i]; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void +__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT { + for (size_type __i = 0; __i < _N_words; ++__i) + __first_[__i] |= __v.__first_[__i]; } template <size_t _N_words, size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void -__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT -{ - for (size_type __i = 0; __i < _N_words; ++__i) - __first_[__i] ^= __v.__first_[__i]; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void +__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT { + for (size_type __i = 0; __i < _N_words; ++__i) + __first_[__i] ^= __v.__first_[__i]; } template <size_t _N_words, size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void -__bitset<_N_words, _Size>::flip() _NOEXCEPT -{ - // do middle whole words - size_type __n = _Size; - __storage_pointer __p = __first_; - for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) - *__p = ~*__p; - // do last partial word - if (__n > 0) - { - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - __storage_type __b = *__p & __m; - *__p &= ~__m; - *__p |= ~__b & __m; - } +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void __bitset<_N_words, _Size>::flip() _NOEXCEPT { + // do middle whole words + size_type __n = _Size; + __storage_pointer __p = __first_; + for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) + *__p = ~*__p; + // do last partial word + if (__n > 0) { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + __storage_type __b = *__p & __m; + *__p &= ~__m; + *__p |= ~__b & __m; + } } template <size_t _N_words, size_t _Size> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long -__bitset<_N_words, _Size>::to_ulong(false_type) const -{ - const_iterator __e = __make_iter(_Size); - const_iterator __i = std::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true); - if (__i != __e) - __throw_overflow_error("bitset to_ulong overflow error"); +__bitset<_N_words, _Size>::to_ulong(false_type) const { + const_iterator __e = __make_iter(_Size); + const_iterator __i = std::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true); + if (__i != __e) + __throw_overflow_error("bitset to_ulong overflow error"); - return __first_[0]; + return __first_[0]; } template <size_t _N_words, size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long -__bitset<_N_words, _Size>::to_ulong(true_type) const -{ - return __first_[0]; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long +__bitset<_N_words, _Size>::to_ulong(true_type) const { + return __first_[0]; } template <size_t _N_words, size_t _Size> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long -__bitset<_N_words, _Size>::to_ullong(false_type) const -{ - const_iterator __e = __make_iter(_Size); - const_iterator __i = std::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true); - if (__i != __e) - __throw_overflow_error("bitset to_ullong overflow error"); +__bitset<_N_words, _Size>::to_ullong(false_type) const { + const_iterator __e = __make_iter(_Size); + const_iterator __i = std::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true); + if (__i != __e) + __throw_overflow_error("bitset to_ullong overflow error"); - return to_ullong(true_type()); + return to_ullong(true_type()); } template <size_t _N_words, size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 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)>()); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 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)>()); } template <size_t _N_words, size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long -__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const -{ - return __first_[0]; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 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> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long -__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const -{ - unsigned long long __r = __first_[0]; - for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i) - __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT); - return __r; +__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const { + unsigned long long __r = __first_[0]; + for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i) + __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT); + return __r; } template <size_t _N_words, size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool -__bitset<_N_words, _Size>::all() const _NOEXCEPT -{ - // do middle whole words - size_type __n = _Size; - __const_storage_pointer __p = __first_; - for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) - if (~*__p) - return false; - // do last partial word - if (__n > 0) - { - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - if (~*__p & __m) - return false; - } - return true; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Size>::all() const _NOEXCEPT { + // do middle whole words + size_type __n = _Size; + __const_storage_pointer __p = __first_; + for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) + if (~*__p) + return false; + // do last partial word + if (__n > 0) { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + if (~*__p & __m) + return false; + } + return true; } template <size_t _N_words, size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool -__bitset<_N_words, _Size>::any() const _NOEXCEPT -{ - // do middle whole words - size_type __n = _Size; - __const_storage_pointer __p = __first_; - for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) - if (*__p) - return true; - // do last partial word - if (__n > 0) - { - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); - if (*__p & __m) - return true; - } - return false; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Size>::any() const _NOEXCEPT { + // do middle whole words + size_type __n = _Size; + __const_storage_pointer __p = __first_; + for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) + if (*__p) + return true; + // do last partial word + if (__n > 0) { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); + if (*__p & __m) + return true; + } + return false; } template <size_t _N_words, size_t _Size> -inline -size_t -__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT -{ - size_t __h = 0; - for (size_type __i = 0; __i < _N_words; ++__i) - __h ^= __first_[__i]; - return __h; +inline size_t __bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT { + size_t __h = 0; + for (size_type __i = 0; __i < _N_words; ++__i) + __h ^= __first_[__i]; + return __h; } template <size_t _Size> -class __bitset<1, _Size> -{ +class __bitset<1, _Size> { public: - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef size_type __storage_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef size_type __storage_type; + protected: - typedef __bitset __self; - typedef __storage_type* __storage_pointer; - typedef const __storage_type* __const_storage_pointer; - static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); - - friend class __bit_reference<__bitset>; - friend class __bit_const_reference<__bitset>; - friend class __bit_iterator<__bitset, false>; - friend class __bit_iterator<__bitset, true>; - friend struct __bit_array<__bitset>; - - __storage_type __first_; - - typedef __bit_reference<__bitset> reference; - typedef __bit_const_reference<__bitset> const_reference; - typedef __bit_iterator<__bitset, false> iterator; - typedef __bit_iterator<__bitset, true> const_iterator; - - _LIBCPP_HIDE_FROM_ABI - _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI - explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT - {return reference(&__first_, __storage_type(1) << __pos);} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT - {return const_reference(&__first_, __storage_type(1) << __pos);} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT - {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT - {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - void operator&=(const __bitset& __v) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - void operator|=(const __bitset& __v) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - void operator^=(const __bitset& __v) _NOEXCEPT; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - void flip() _NOEXCEPT; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long to_ulong() const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long long to_ullong() const; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bool all() const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bool any() const _NOEXCEPT; - - _LIBCPP_HIDE_FROM_ABI - size_t __hash_code() const _NOEXCEPT; + typedef __bitset __self; + typedef __storage_type* __storage_pointer; + typedef const __storage_type* __const_storage_pointer; + static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); + + friend class __bit_reference<__bitset>; + friend class __bit_const_reference<__bitset>; + friend class __bit_iterator<__bitset, false>; + friend class __bit_iterator<__bitset, true>; + friend struct __bit_array<__bitset>; + + __storage_type __first_; + + typedef __bit_reference<__bitset> reference; + typedef __bit_const_reference<__bitset> const_reference; + typedef __bit_iterator<__bitset, false> iterator; + typedef __bit_iterator<__bitset, true> const_iterator; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT { + return reference(&__first_, __storage_type(1) << __pos); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT { + return const_reference(&__first_, __storage_type(1) << __pos); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT { + return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT { + return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word); + } + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset& __v) _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT; }; template <size_t _Size> -inline -_LIBCPP_CONSTEXPR -__bitset<1, _Size>::__bitset() _NOEXCEPT - : __first_(0) -{ -} +inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset() _NOEXCEPT : __first_(0) {} template <size_t _Size> -inline -_LIBCPP_CONSTEXPR -__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT - : __first_( - _Size == __bits_per_word ? static_cast<__storage_type>(__v) - : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1) - ) -{ -} +inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT + : __first_(_Size == __bits_per_word ? static_cast<__storage_type>(__v) + : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1)) {} template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void -__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT -{ - __first_ &= __v.__first_; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void +__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT { + __first_ &= __v.__first_; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void -__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT -{ - __first_ |= __v.__first_; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void +__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT { + __first_ |= __v.__first_; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void -__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT -{ - __first_ ^= __v.__first_; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void +__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT { + __first_ ^= __v.__first_; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void -__bitset<1, _Size>::flip() _NOEXCEPT -{ - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); - __first_ = ~__first_; - __first_ &= __m; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void __bitset<1, _Size>::flip() _NOEXCEPT { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); + __first_ = ~__first_; + __first_ &= __m; } template <size_t _Size> -inline -_LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long -__bitset<1, _Size>::to_ulong() const -{ - return __first_; +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long __bitset<1, _Size>::to_ulong() const { + return __first_; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long -__bitset<1, _Size>::to_ullong() const -{ - return __first_; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long __bitset<1, _Size>::to_ullong() const { + return __first_; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool -__bitset<1, _Size>::all() const _NOEXCEPT -{ - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); - return !(~__first_ & __m); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<1, _Size>::all() const _NOEXCEPT { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); + return !(~__first_ & __m); } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool -__bitset<1, _Size>::any() const _NOEXCEPT -{ - __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); - return __first_ & __m; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<1, _Size>::any() const _NOEXCEPT { + __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); + return __first_ & __m; } template <size_t _Size> -inline -size_t -__bitset<1, _Size>::__hash_code() const _NOEXCEPT -{ - return __first_; +inline size_t __bitset<1, _Size>::__hash_code() const _NOEXCEPT { + return __first_; } template <> -class __bitset<0, 0> -{ +class __bitset<0, 0> { public: - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef size_type __storage_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef size_type __storage_type; + protected: - typedef __bitset __self; - typedef __storage_type* __storage_pointer; - typedef const __storage_type* __const_storage_pointer; - static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); - - friend class __bit_reference<__bitset>; - friend class __bit_const_reference<__bitset>; - friend class __bit_iterator<__bitset, false>; - friend class __bit_iterator<__bitset, true>; - friend struct __bit_array<__bitset>; - - typedef __bit_reference<__bitset> reference; - typedef __bit_const_reference<__bitset> const_reference; - typedef __bit_iterator<__bitset, false> iterator; - typedef __bit_iterator<__bitset, true> const_iterator; - - _LIBCPP_HIDE_FROM_ABI - _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI - explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t) _NOEXCEPT - {return reference(nullptr, 1);} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT - {return const_reference(nullptr, 1);} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t) _NOEXCEPT - {return iterator(nullptr, 0);} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t) const _NOEXCEPT - {return const_iterator(nullptr, 0);} - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset&) _NOEXCEPT {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset&) _NOEXCEPT {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset&) _NOEXCEPT {} - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT {} - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const {return 0;} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const {return 0;} - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT {return true;} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT {return false;} - - _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT {return 0;} + typedef __bitset __self; + typedef __storage_type* __storage_pointer; + typedef const __storage_type* __const_storage_pointer; + static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); + + friend class __bit_reference<__bitset>; + friend class __bit_const_reference<__bitset>; + friend class __bit_iterator<__bitset, false>; + friend class __bit_iterator<__bitset, true>; + friend struct __bit_array<__bitset>; + + typedef __bit_reference<__bitset> reference; + typedef __bit_const_reference<__bitset> const_reference; + typedef __bit_iterator<__bitset, false> iterator; + typedef __bit_iterator<__bitset, true> const_iterator; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t) _NOEXCEPT { + return reference(nullptr, 1); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT { + return const_reference(nullptr, 1); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t) _NOEXCEPT { + return iterator(nullptr, 0); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t) const _NOEXCEPT { + return const_iterator(nullptr, 0); + } + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset&) _NOEXCEPT {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset&) _NOEXCEPT {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset&) _NOEXCEPT {} + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT {} + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const { return 0; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const { return 0; } + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT { return true; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT { return false; } + + _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return 0; } }; -inline -_LIBCPP_CONSTEXPR -__bitset<0, 0>::__bitset() _NOEXCEPT -{ -} +inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset() _NOEXCEPT {} -inline -_LIBCPP_CONSTEXPR -__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT -{ -} +inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT {} -template <size_t _Size> class _LIBCPP_TEMPLATE_VIS bitset; -template <size_t _Size> struct hash<bitset<_Size> >; +template <size_t _Size> +class _LIBCPP_TEMPLATE_VIS bitset; +template <size_t _Size> +struct hash<bitset<_Size> >; template <size_t _Size> class _LIBCPP_TEMPLATE_VIS bitset - : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size> -{ + : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size> { public: - static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1; - typedef __bitset<__n_words, _Size> base; + static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1; + typedef __bitset<__n_words, _Size> base; public: - typedef typename base::reference reference; - typedef typename base::const_reference const_reference; - - // 23.3.5.1 constructors: - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {} - _LIBCPP_HIDE_FROM_ABI _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_SINCE_CXX23 explicit bitset( - const _CharT* __str, -# if _LIBCPP_STD_VER >= 26 - typename basic_string_view<_CharT>::size_type __n = basic_string_view<_CharT>::npos, -# else - typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, -# endif - _CharT __zero = _CharT('0'), - _CharT __one = _CharT('1')) { - - size_t __rlen = std::min(__n, char_traits<_CharT>::length(__str)); - __init_from_string_view(basic_string_view<_CharT>(__str, __rlen), __zero, __one); - } + typedef typename base::reference reference; + typedef typename base::const_reference const_reference; + + // 23.3.5.1 constructors: + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {} + _LIBCPP_HIDE_FROM_ABI _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_SINCE_CXX23 explicit bitset( + const _CharT* __str, #if _LIBCPP_STD_VER >= 26 - template <class _CharT, class _Traits> - _LIBCPP_HIDE_FROM_ABI 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')) { - if (__pos > __str.size()) - __throw_out_of_range("bitset string pos out of range"); - - size_t __rlen = std::min(__n, __str.size() - __pos); - __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one); - } + typename basic_string_view<_CharT>::size_type __n = basic_string_view<_CharT>::npos, +#else + typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, #endif - template <class _CharT, class _Traits, class _Allocator> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 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')) { - if (__pos > __str.size()) - std::__throw_out_of_range("bitset string pos out of range"); - - size_t __rlen = std::min(__n, __str.size() - __pos); - __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one); - } - - // 23.3.5.2 bitset operations: - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& operator&=(const bitset& __rhs) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& operator|=(const bitset& __rhs) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& operator^=(const bitset& __rhs) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& operator<<=(size_t __pos) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& operator>>=(size_t __pos) _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& set() _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& set(size_t __pos, bool __val = true); - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& reset() _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& reset(size_t __pos); - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset operator~() const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& flip() _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset& flip(size_t __pos); + _CharT __zero = _CharT('0'), + _CharT __one = _CharT('1')) { - // element access: + size_t __rlen = std::min(__n, char_traits<_CharT>::length(__str)); + __init_from_string_view(basic_string_view<_CharT>(__str, __rlen), __zero, __one); + } +#if _LIBCPP_STD_VER >= 26 + template <class _CharT, class _Traits> + _LIBCPP_HIDE_FROM_ABI 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')) { + if (__pos > __str.size()) + __throw_out_of_range("bitset string pos out of range"); + + size_t __rlen = std::min(__n, __str.size() - __pos); + __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one); + } +#endif + template <class _CharT, class _Traits, class _Allocator> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 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')) { + if (__pos > __str.size()) + std::__throw_out_of_range("bitset string pos out of range"); + + size_t __rlen = std::min(__n, __str.size() - __pos); + __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one); + } + + // 23.3.5.2 bitset operations: + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator&=(const bitset& __rhs) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator|=(const bitset& __rhs) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator^=(const bitset& __rhs) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator<<=(size_t __pos) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& operator>>=(size_t __pos) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& set() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& set(size_t __pos, bool __val = true); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& reset() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& reset(size_t __pos); + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator~() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& flip() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset& flip(size_t __pos); + + // element access: #ifdef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const {return base::__make_ref(__p);} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const { return base::__make_ref(__p); } #else - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const {return base::__make_ref(__p);} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const { return base::__make_ref(__p); } #endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) {return base::__make_ref(__p);} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long to_ulong() const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - unsigned long long to_ullong() const; - template <class _CharT, class _Traits, class _Allocator> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'), - _CharT __one = _CharT('1')) const; - template <class _CharT, class _Traits> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), - _CharT __one = _CharT('1')) const; - template <class _CharT> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), - _CharT __one = _CharT('1')) const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0', - char __one = '1') const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - size_t count() const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bool operator==(const bitset& __rhs) const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) { return base::__make_ref(__p); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const; + template <class _CharT, class _Traits, class _Allocator> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, _Allocator> + to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; + template <class _CharT, class _Traits> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, allocator<_CharT> > + to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; + template <class _CharT> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > + to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<char, char_traits<char>, allocator<char> > + to_string(char __zero = '0', char __one = '1') const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t count() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT { return _Size; } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const bitset& __rhs) const _NOEXCEPT; #if _LIBCPP_STD_VER <= 17 - _LIBCPP_HIDE_FROM_ABI - bool operator!=(const bitset& __rhs) const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI bool operator!=(const bitset& __rhs) const _NOEXCEPT; #endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bool test(size_t __pos) const; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bool all() const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bool any() const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT {return !any();} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset operator<<(size_t __pos) const _NOEXCEPT; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 - bitset operator>>(size_t __pos) const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool test(size_t __pos) const; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT { return !any(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator<<(size_t __pos) const _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset operator>>(size_t __pos) const _NOEXCEPT; private: - template <class _CharT, class _Traits> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void - __init_from_string_view(basic_string_view<_CharT, _Traits> __str, _CharT __zero, _CharT __one) { - - for (size_t __i = 0; __i < __str.size(); ++__i) - if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one)) - std::__throw_invalid_argument("bitset string ctor has invalid argument"); - - size_t __mp = std::min(__str.size(), _Size); - size_t __i = 0; - for (; __i < __mp; ++__i) { - _CharT __c = __str[__mp - 1 - __i]; - (*this)[__i] = _Traits::eq(__c, __one); - } - std::fill(base::__make_iter(__i), base::__make_iter(_Size), false); + template <class _CharT, class _Traits> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void + __init_from_string_view(basic_string_view<_CharT, _Traits> __str, _CharT __zero, _CharT __one) { + for (size_t __i = 0; __i < __str.size(); ++__i) + if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one)) + std::__throw_invalid_argument("bitset string ctor has invalid argument"); + + size_t __mp = std::min(__str.size(), _Size); + size_t __i = 0; + for (; __i < __mp; ++__i) { + _CharT __c = __str[__mp - 1 - __i]; + (*this)[__i] = _Traits::eq(__c, __one); } + std::fill(base::__make_iter(__i), base::__make_iter(_Size), false); + } - _LIBCPP_HIDE_FROM_ABI - size_t __hash_code() const _NOEXCEPT {return base::__hash_code();} + _LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return base::__hash_code(); } - friend struct hash<bitset>; + friend struct hash<bitset>; }; template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT -{ - base::operator&=(__rhs); - return *this; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& +bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT { + base::operator&=(__rhs); + return *this; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT -{ - base::operator|=(__rhs); - return *this; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& +bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT { + base::operator|=(__rhs); + return *this; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT -{ - base::operator^=(__rhs); - return *this; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& +bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT { + base::operator^=(__rhs); + return *this; } template <size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT -{ - __pos = std::min(__pos, _Size); - std::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size)); - std::fill_n(base::__make_iter(0), __pos, false); - return *this; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT { + __pos = std::min(__pos, _Size); + std::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size)); + std::fill_n(base::__make_iter(0), __pos, false); + return *this; } template <size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT -{ - __pos = std::min(__pos, _Size); - std::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0)); - std::fill_n(base::__make_iter(_Size - __pos), __pos, false); - return *this; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT { + __pos = std::min(__pos, _Size); + std::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0)); + std::fill_n(base::__make_iter(_Size - __pos), __pos, false); + return *this; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::set() _NOEXCEPT -{ - std::fill_n(base::__make_iter(0), _Size, true); - return *this; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set() _NOEXCEPT { + std::fill_n(base::__make_iter(0), _Size, true); + return *this; } template <size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::set(size_t __pos, bool __val) -{ - if (__pos >= _Size) - __throw_out_of_range("bitset set argument out of range"); +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set(size_t __pos, bool __val) { + if (__pos >= _Size) + __throw_out_of_range("bitset set argument out of range"); - (*this)[__pos] = __val; - return *this; + (*this)[__pos] = __val; + return *this; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::reset() _NOEXCEPT -{ - std::fill_n(base::__make_iter(0), _Size, false); - return *this; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset() _NOEXCEPT { + std::fill_n(base::__make_iter(0), _Size, false); + return *this; } template <size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::reset(size_t __pos) -{ - if (__pos >= _Size) - __throw_out_of_range("bitset reset argument out of range"); +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset(size_t __pos) { + if (__pos >= _Size) + __throw_out_of_range("bitset reset argument out of range"); - (*this)[__pos] = false; - return *this; + (*this)[__pos] = false; + return *this; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size> -bitset<_Size>::operator~() const _NOEXCEPT -{ - bitset __x(*this); - __x.flip(); - return __x; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size> bitset<_Size>::operator~() const _NOEXCEPT { + bitset __x(*this); + __x.flip(); + return __x; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::flip() _NOEXCEPT -{ - base::flip(); - return *this; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip() _NOEXCEPT { + base::flip(); + return *this; } template <size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size>& -bitset<_Size>::flip(size_t __pos) -{ - if (__pos >= _Size) - __throw_out_of_range("bitset flip argument out of range"); +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip(size_t __pos) { + if (__pos >= _Size) + __throw_out_of_range("bitset flip argument out of range"); - reference __r = base::__make_ref(__pos); - __r = ~__r; - return *this; + reference __r = base::__make_ref(__pos); + __r = ~__r; + return *this; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -unsigned long -bitset<_Size>::to_ulong() const -{ - return base::to_ulong(); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long bitset<_Size>::to_ulong() const { + return base::to_ulong(); } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -unsigned long long -bitset<_Size>::to_ullong() const -{ - return base::to_ullong(); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long bitset<_Size>::to_ullong() const { + return base::to_ullong(); } template <size_t _Size> template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -basic_string<_CharT, _Traits, _Allocator> -bitset<_Size>::to_string(_CharT __zero, _CharT __one) const -{ - basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero); - for (size_t __i = 0; __i != _Size; ++__i) - { - if ((*this)[__i]) - __r[_Size - 1 - __i] = __one; - } - return __r; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, _Allocator> +bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { + basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero); + for (size_t __i = 0; __i != _Size; ++__i) { + if ((*this)[__i]) + __r[_Size - 1 - __i] = __one; + } + return __r; } template <size_t _Size> template <class _CharT, class _Traits> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -basic_string<_CharT, _Traits, allocator<_CharT> > -bitset<_Size>::to_string(_CharT __zero, _CharT __one) const -{ - return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, _Traits, allocator<_CharT> > +bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { + return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one); } template <size_t _Size> template <class _CharT> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > -bitset<_Size>::to_string(_CharT __zero, _CharT __one) const -{ - return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > +bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { + return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one); } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -basic_string<char, char_traits<char>, allocator<char> > -bitset<_Size>::to_string(char __zero, char __one) const -{ - return to_string<char, char_traits<char>, allocator<char> >(__zero, __one); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 basic_string<char, char_traits<char>, allocator<char> > +bitset<_Size>::to_string(char __zero, char __one) const { + return to_string<char, char_traits<char>, allocator<char> >(__zero, __one); } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -size_t -bitset<_Size>::count() const _NOEXCEPT -{ - return static_cast<size_t>(std::count(base::__make_iter(0), base::__make_iter(_Size), true)); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 size_t bitset<_Size>::count() const _NOEXCEPT { + return static_cast<size_t>(std::count(base::__make_iter(0), base::__make_iter(_Size), true)); } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bool -bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT -{ - return std::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0)); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT { + return std::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0)); } #if _LIBCPP_STD_VER <= 17 template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI -bool -bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT -{ - return !(*this == __rhs); +inline _LIBCPP_HIDE_FROM_ABI bool bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT { + return !(*this == __rhs); } #endif template <size_t _Size> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bool -bitset<_Size>::test(size_t __pos) const -{ - if (__pos >= _Size) - __throw_out_of_range("bitset test argument out of range"); +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::test(size_t __pos) const { + if (__pos >= _Size) + __throw_out_of_range("bitset test argument out of range"); - return (*this)[__pos]; + return (*this)[__pos]; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bool -bitset<_Size>::all() const _NOEXCEPT -{ - return base::all(); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::all() const _NOEXCEPT { + return base::all(); } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bool -bitset<_Size>::any() const _NOEXCEPT -{ - return base::any(); +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::any() const _NOEXCEPT { + return base::any(); } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size> -bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT -{ - bitset __r = *this; - __r <<= __pos; - return __r; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size> +bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT { + bitset __r = *this; + __r <<= __pos; + return __r; } template <size_t _Size> -inline -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size> -bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT -{ - bitset __r = *this; - __r >>= __pos; - return __r; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size> +bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT { + bitset __r = *this; + __r >>= __pos; + return __r; } template <size_t _Size> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size> -operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT -{ - bitset<_Size> __r = __x; - __r &= __y; - return __r; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size> +operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT { + bitset<_Size> __r = __x; + __r &= __y; + return __r; } template <size_t _Size> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size> -operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT -{ - bitset<_Size> __r = __x; - __r |= __y; - return __r; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size> +operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT { + bitset<_Size> __r = __x; + __r |= __y; + return __r; } template <size_t _Size> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 -bitset<_Size> -operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT -{ - bitset<_Size> __r = __x; - __r ^= __y; - return __r; +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size> +operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT { + bitset<_Size> __r = __x; + __r ^= __y; + return __r; } template <size_t _Size> -struct _LIBCPP_TEMPLATE_VIS hash<bitset<_Size> > - : public __unary_function<bitset<_Size>, size_t> -{ - _LIBCPP_HIDE_FROM_ABI - size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT - {return __bs.__hash_code();} +struct _LIBCPP_TEMPLATE_VIS hash<bitset<_Size> > : public __unary_function<bitset<_Size>, size_t> { + _LIBCPP_HIDE_FROM_ABI size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT { return __bs.__hash_code(); } }; template <class _CharT, class _Traits, size_t _Size> |