2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP_BITSET
11 #define _LIBCPP_BITSET
31 ~reference() noexcept;
32 reference& operator=(bool x) noexcept; // for b[i] = x;
33 reference& operator=(const reference&) noexcept; // for b[i] = b[j];
34 bool operator~() const noexcept; // flips the bit
35 operator bool() const noexcept; // for x = b[i];
36 reference& flip() noexcept; // for b[i].flip();
39 // 23.3.5.1 constructors:
40 constexpr bitset() noexcept;
41 constexpr bitset(unsigned long long val) noexcept;
42 template <class charT>
43 constexpr explicit bitset(const charT* str,
44 typename basic_string<charT>::size_type n = basic_string<charT>::npos,
45 charT zero = charT('0'), charT one = charT('1')); // until C++26, constexpr since C++23
46 template <class charT>
47 constexpr explicit bitset(const charT* str,
48 typename basic_string_view<charT>::size_type n = basic_string_view<charT>::npos,
49 charT zero = charT('0'), charT one = charT('1')); // since C++26
50 template<class charT, class traits>
52 const basic_string_view<charT,traits>& str,
53 typename basic_string_view<charT,traits>::size_type pos = 0,
54 typename basic_string_view<charT,traits>::size_type n = basic_string_view<charT,traits>::npos,
55 charT zero = charT('0'), charT one = charT('1')); // since C++26
56 template<class charT, class traits, class Allocator>
57 constexpr explicit bitset(
58 const basic_string<charT,traits,Allocator>& str,
59 typename basic_string<charT,traits,Allocator>::size_type pos = 0,
60 typename basic_string<charT,traits,Allocator>::size_type n = basic_string<charT,traits,Allocator>::npos,
61 charT zero = charT('0'), charT one = charT('1')); // constexpr since C++23
63 // 23.3.5.2 bitset operations:
64 bitset& operator&=(const bitset& rhs) noexcept; // constexpr since C++23
65 bitset& operator|=(const bitset& rhs) noexcept; // constexpr since C++23
66 bitset& operator^=(const bitset& rhs) noexcept; // constexpr since C++23
67 bitset& operator<<=(size_t pos) noexcept; // constexpr since C++23
68 bitset& operator>>=(size_t pos) noexcept; // constexpr since C++23
69 bitset& set() noexcept; // constexpr since C++23
70 bitset& set(size_t pos, bool val = true); // constexpr since C++23
71 bitset& reset() noexcept; // constexpr since C++23
72 bitset& reset(size_t pos); // constexpr since C++23
73 bitset operator~() const noexcept; // constexpr since C++23
74 bitset& flip() noexcept; // constexpr since C++23
75 bitset& flip(size_t pos); // constexpr since C++23
78 constexpr bool operator[](size_t pos) const;
79 reference operator[](size_t pos); // constexpr since C++23
80 unsigned long to_ulong() const; // constexpr since C++23
81 unsigned long long to_ullong() const; // constexpr since C++23
82 template <class charT, class traits, class Allocator> // constexpr since C++23
83 basic_string<charT, traits, Allocator> to_string(charT zero = charT('0'), charT one = charT('1')) const;
84 template <class charT, class traits> // constexpr since C++23
85 basic_string<charT, traits, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
86 template <class charT> // constexpr since C++23
87 basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
88 basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const; // constexpr since C++23
89 size_t count() const noexcept; // constexpr since C++23
90 constexpr size_t size() const noexcept; // constexpr since C++23
91 bool operator==(const bitset& rhs) const noexcept; // constexpr since C++23
92 bool operator!=(const bitset& rhs) const noexcept; // removed in C++20
93 bool test(size_t pos) const; // constexpr since C++23
94 bool all() const noexcept; // constexpr since C++23
95 bool any() const noexcept; // constexpr since C++23
96 bool none() const noexcept; // constexpr since C++23
97 bitset<N> operator<<(size_t pos) const noexcept; // constexpr since C++23
98 bitset<N> operator>>(size_t pos) const noexcept; // constexpr since C++23
101 // 23.3.5.3 bitset operators:
103 bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept; // constexpr since C++23
106 bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept; // constexpr since C++23
109 bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept; // constexpr since C++23
111 template <class charT, class traits, size_t N>
112 basic_istream<charT, traits>&
113 operator>>(basic_istream<charT, traits>& is, bitset<N>& x);
115 template <class charT, class traits, size_t N>
116 basic_ostream<charT, traits>&
117 operator<<(basic_ostream<charT, traits>& os, const bitset<N>& x);
119 template <size_t N> struct hash<std::bitset<N>>;
125 #include <__algorithm/count.h>
126 #include <__algorithm/fill.h>
127 #include <__algorithm/find.h>
128 #include <__assert> // all public C++ headers provide the assertion handler
129 #include <__bit_reference>
131 #include <__functional/hash.h>
132 #include <__functional/unary_function.h>
133 #include <__type_traits/is_char_like_type.h>
137 #include <string_view>
140 // standard-mandated includes
146 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
147 # pragma GCC system_header
151 #include <__undef_macros>
154 _LIBCPP_BEGIN_NAMESPACE_STD
156 template <size_t _N_words, size_t _Size>
159 template <size_t _N_words, size_t _Size>
160 struct __has_storage_type<__bitset<_N_words, _Size> >
162 static const bool value = true;
165 template <size_t _N_words, size_t _Size>
169 typedef ptrdiff_t difference_type;
170 typedef size_t size_type;
171 typedef size_type __storage_type;
173 typedef __bitset __self;
174 typedef __storage_type* __storage_pointer;
175 typedef const __storage_type* __const_storage_pointer;
176 static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
178 friend class __bit_reference<__bitset>;
179 friend class __bit_const_reference<__bitset>;
180 friend class __bit_iterator<__bitset, false>;
181 friend class __bit_iterator<__bitset, true>;
182 friend struct __bit_array<__bitset>;
184 __storage_type __first_[_N_words];
186 typedef __bit_reference<__bitset> reference;
187 typedef __bit_const_reference<__bitset> const_reference;
188 typedef __bit_iterator<__bitset, false> iterator;
189 typedef __bit_iterator<__bitset, true> const_iterator;
191 _LIBCPP_INLINE_VISIBILITY
192 _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
193 _LIBCPP_INLINE_VISIBILITY
194 explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
196 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT
197 {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
198 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
199 {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
200 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT
201 {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
202 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT
203 {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
205 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
206 void operator&=(const __bitset& __v) _NOEXCEPT;
207 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
208 void operator|=(const __bitset& __v) _NOEXCEPT;
209 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
210 void operator^=(const __bitset& __v) _NOEXCEPT;
212 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT;
213 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const
214 {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
215 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const
216 {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
218 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT;
219 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT;
220 _LIBCPP_INLINE_VISIBILITY
221 size_t __hash_code() const _NOEXCEPT;
223 #ifdef _LIBCPP_CXX03_LANG
224 void __init(unsigned long long __v, false_type) _NOEXCEPT;
225 _LIBCPP_INLINE_VISIBILITY
226 void __init(unsigned long long __v, true_type) _NOEXCEPT;
227 #endif // _LIBCPP_CXX03_LANG
228 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
229 unsigned long to_ulong(false_type) const;
230 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
231 unsigned long to_ulong(true_type) const;
232 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
233 unsigned long long to_ullong(false_type) const;
234 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
235 unsigned long long to_ullong(true_type) const;
236 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
237 unsigned long long to_ullong(true_type, false_type) const;
238 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
239 unsigned long long to_ullong(true_type, true_type) const;
242 template <size_t _N_words, size_t _Size>
245 __bitset<_N_words, _Size>::__bitset() _NOEXCEPT
246 #ifndef _LIBCPP_CXX03_LANG
250 #ifdef _LIBCPP_CXX03_LANG
251 _VSTD::fill_n(__first_, _N_words, __storage_type(0));
255 #ifdef _LIBCPP_CXX03_LANG
257 template <size_t _N_words, size_t _Size>
259 __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
261 __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
263 for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word, __sz -= __bits_per_word )
264 if ( __sz < __bits_per_word)
265 __t[__i] = static_cast<__storage_type>(__v) & ( 1ULL << __sz ) - 1;
267 __t[__i] = static_cast<__storage_type>(__v);
269 _VSTD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
270 _VSTD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
274 template <size_t _N_words, size_t _Size>
275 inline _LIBCPP_INLINE_VISIBILITY
277 __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
280 if (_Size < __bits_per_word)
281 __first_[0] &= ( 1ULL << _Size ) - 1;
283 _VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
286 #endif // _LIBCPP_CXX03_LANG
288 template <size_t _N_words, size_t _Size>
291 __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
292 #ifndef _LIBCPP_CXX03_LANG
293 #if __SIZEOF_SIZE_T__ == 8
295 #elif __SIZEOF_SIZE_T__ == 4
296 : __first_{static_cast<__storage_type>(__v),
297 _Size >= 2 * __bits_per_word ? static_cast<__storage_type>(__v >> __bits_per_word)
298 : static_cast<__storage_type>((__v >> __bits_per_word) & (__storage_type(1) << (_Size - __bits_per_word)) - 1)}
300 #error This constructor has not been ported to this platform
304 #ifdef _LIBCPP_CXX03_LANG
305 __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
309 template <size_t _N_words, size_t _Size>
311 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
312 __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
314 for (size_type __i = 0; __i < _N_words; ++__i)
315 __first_[__i] &= __v.__first_[__i];
318 template <size_t _N_words, size_t _Size>
320 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
321 __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
323 for (size_type __i = 0; __i < _N_words; ++__i)
324 __first_[__i] |= __v.__first_[__i];
327 template <size_t _N_words, size_t _Size>
329 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
330 __bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
332 for (size_type __i = 0; __i < _N_words; ++__i)
333 __first_[__i] ^= __v.__first_[__i];
336 template <size_t _N_words, size_t _Size>
337 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
338 __bitset<_N_words, _Size>::flip() _NOEXCEPT
340 // do middle whole words
341 size_type __n = _Size;
342 __storage_pointer __p = __first_;
343 for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
345 // do last partial word
348 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
349 __storage_type __b = *__p & __m;
355 template <size_t _N_words, size_t _Size>
356 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
357 __bitset<_N_words, _Size>::to_ulong(false_type) const
359 const_iterator __e = __make_iter(_Size);
360 const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
362 __throw_overflow_error("bitset to_ulong overflow error");
367 template <size_t _N_words, size_t _Size>
369 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
370 __bitset<_N_words, _Size>::to_ulong(true_type) const
375 template <size_t _N_words, size_t _Size>
376 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
377 __bitset<_N_words, _Size>::to_ullong(false_type) const
379 const_iterator __e = __make_iter(_Size);
380 const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
382 __throw_overflow_error("bitset to_ullong overflow error");
384 return to_ullong(true_type());
387 template <size_t _N_words, size_t _Size>
389 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
390 __bitset<_N_words, _Size>::to_ullong(true_type) const
392 return to_ullong(true_type(), integral_constant<bool, sizeof(__storage_type) < sizeof(unsigned long long)>());
395 template <size_t _N_words, size_t _Size>
397 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
398 __bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
403 template <size_t _N_words, size_t _Size>
404 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
405 __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
407 unsigned long long __r = __first_[0];
408 for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
409 __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
413 template <size_t _N_words, size_t _Size>
414 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
415 __bitset<_N_words, _Size>::all() const _NOEXCEPT
417 // do middle whole words
418 size_type __n = _Size;
419 __const_storage_pointer __p = __first_;
420 for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
423 // do last partial word
426 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
433 template <size_t _N_words, size_t _Size>
434 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
435 __bitset<_N_words, _Size>::any() const _NOEXCEPT
437 // do middle whole words
438 size_type __n = _Size;
439 __const_storage_pointer __p = __first_;
440 for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
443 // do last partial word
446 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
453 template <size_t _N_words, size_t _Size>
456 __bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
459 for (size_type __i = 0; __i < _N_words; ++__i)
460 __h ^= __first_[__i];
464 template <size_t _Size>
465 class __bitset<1, _Size>
468 typedef ptrdiff_t difference_type;
469 typedef size_t size_type;
470 typedef size_type __storage_type;
472 typedef __bitset __self;
473 typedef __storage_type* __storage_pointer;
474 typedef const __storage_type* __const_storage_pointer;
475 static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
477 friend class __bit_reference<__bitset>;
478 friend class __bit_const_reference<__bitset>;
479 friend class __bit_iterator<__bitset, false>;
480 friend class __bit_iterator<__bitset, true>;
481 friend struct __bit_array<__bitset>;
483 __storage_type __first_;
485 typedef __bit_reference<__bitset> reference;
486 typedef __bit_const_reference<__bitset> const_reference;
487 typedef __bit_iterator<__bitset, false> iterator;
488 typedef __bit_iterator<__bitset, true> const_iterator;
490 _LIBCPP_INLINE_VISIBILITY
491 _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
492 _LIBCPP_INLINE_VISIBILITY
493 explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
495 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t __pos) _NOEXCEPT
496 {return reference(&__first_, __storage_type(1) << __pos);}
497 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
498 {return const_reference(&__first_, __storage_type(1) << __pos);}
499 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t __pos) _NOEXCEPT
500 {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
501 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t __pos) const _NOEXCEPT
502 {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
504 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
505 void operator&=(const __bitset& __v) _NOEXCEPT;
506 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
507 void operator|=(const __bitset& __v) _NOEXCEPT;
508 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
509 void operator^=(const __bitset& __v) _NOEXCEPT;
511 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
512 void flip() _NOEXCEPT;
514 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
515 unsigned long to_ulong() const;
516 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
517 unsigned long long to_ullong() const;
519 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
520 bool all() const _NOEXCEPT;
521 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
522 bool any() const _NOEXCEPT;
524 _LIBCPP_INLINE_VISIBILITY
525 size_t __hash_code() const _NOEXCEPT;
528 template <size_t _Size>
531 __bitset<1, _Size>::__bitset() _NOEXCEPT
536 template <size_t _Size>
539 __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
541 _Size == __bits_per_word ? static_cast<__storage_type>(__v)
542 : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1)
547 template <size_t _Size>
549 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
550 __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
552 __first_ &= __v.__first_;
555 template <size_t _Size>
557 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
558 __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
560 __first_ |= __v.__first_;
563 template <size_t _Size>
565 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
566 __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
568 __first_ ^= __v.__first_;
571 template <size_t _Size>
573 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
574 __bitset<1, _Size>::flip() _NOEXCEPT
576 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
577 __first_ = ~__first_;
581 template <size_t _Size>
583 _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long
584 __bitset<1, _Size>::to_ulong() const
589 template <size_t _Size>
591 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long
592 __bitset<1, _Size>::to_ullong() const
597 template <size_t _Size>
599 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
600 __bitset<1, _Size>::all() const _NOEXCEPT
602 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
603 return !(~__first_ & __m);
606 template <size_t _Size>
608 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
609 __bitset<1, _Size>::any() const _NOEXCEPT
611 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
612 return __first_ & __m;
615 template <size_t _Size>
618 __bitset<1, _Size>::__hash_code() const _NOEXCEPT
627 typedef ptrdiff_t difference_type;
628 typedef size_t size_type;
629 typedef size_type __storage_type;
631 typedef __bitset __self;
632 typedef __storage_type* __storage_pointer;
633 typedef const __storage_type* __const_storage_pointer;
634 static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
636 friend class __bit_reference<__bitset>;
637 friend class __bit_const_reference<__bitset>;
638 friend class __bit_iterator<__bitset, false>;
639 friend class __bit_iterator<__bitset, true>;
640 friend struct __bit_array<__bitset>;
642 typedef __bit_reference<__bitset> reference;
643 typedef __bit_const_reference<__bitset> const_reference;
644 typedef __bit_iterator<__bitset, false> iterator;
645 typedef __bit_iterator<__bitset, true> const_iterator;
647 _LIBCPP_INLINE_VISIBILITY
648 _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
649 _LIBCPP_INLINE_VISIBILITY
650 explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
652 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 reference __make_ref(size_t) _NOEXCEPT
653 {return reference(nullptr, 1);}
654 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
655 {return const_reference(nullptr, 1);}
656 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 iterator __make_iter(size_t) _NOEXCEPT
657 {return iterator(nullptr, 0);}
658 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const_iterator __make_iter(size_t) const _NOEXCEPT
659 {return const_iterator(nullptr, 0);}
661 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator&=(const __bitset&) _NOEXCEPT {}
662 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator|=(const __bitset&) _NOEXCEPT {}
663 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset&) _NOEXCEPT {}
665 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT {}
667 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long to_ulong() const {return 0;}
668 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long long to_ullong() const {return 0;}
670 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool all() const _NOEXCEPT {return true;}
671 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool any() const _NOEXCEPT {return false;}
673 _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
678 __bitset<0, 0>::__bitset() _NOEXCEPT
684 __bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
688 template <size_t _Size> class _LIBCPP_TEMPLATE_VIS bitset;
689 template <size_t _Size> struct hash<bitset<_Size> >;
691 template <size_t _Size>
692 class _LIBCPP_TEMPLATE_VIS bitset
693 : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
696 static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
697 typedef __bitset<__n_words, _Size> base;
700 typedef typename base::reference reference;
701 typedef typename base::const_reference const_reference;
703 // 23.3.5.1 constructors:
704 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
705 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
706 bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
707 template <class _CharT, class = __enable_if_t<_IsCharLikeType<_CharT>::value> >
708 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
710 # if _LIBCPP_STD_VER >= 26
711 typename basic_string_view<_CharT>::size_type __n = basic_string_view<_CharT>::npos,
713 typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
715 _CharT __zero = _CharT('0'),
716 _CharT __one = _CharT('1')) {
718 size_t __rlen = std::min(__n, char_traits<_CharT>::length(__str));
719 __init_from_string_view(basic_string_view<_CharT>(__str, __rlen), __zero, __one);
721 #if _LIBCPP_STD_VER >= 26
722 template <class _CharT, class _Traits>
723 _LIBCPP_HIDE_FROM_ABI constexpr explicit bitset(
724 basic_string_view<_CharT, _Traits> __str,
725 typename basic_string_view<_CharT, _Traits>::size_type __pos = 0,
726 typename basic_string_view<_CharT, _Traits>::size_type __n = basic_string_view<_CharT, _Traits>::npos,
727 _CharT __zero = _CharT('0'),
728 _CharT __one = _CharT('1')) {
729 if (__pos > __str.size())
730 __throw_out_of_range("bitset string pos out of range");
732 size_t __rlen = std::min(__n, __str.size() - __pos);
733 __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
736 template <class _CharT, class _Traits, class _Allocator>
737 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit bitset(
738 const basic_string<_CharT, _Traits, _Allocator>& __str,
739 typename basic_string<_CharT, _Traits, _Allocator>::size_type __pos = 0,
740 typename basic_string<_CharT, _Traits, _Allocator>::size_type __n =
741 basic_string<_CharT, _Traits, _Allocator>::npos,
742 _CharT __zero = _CharT('0'),
743 _CharT __one = _CharT('1')) {
744 if (__pos > __str.size())
745 std::__throw_out_of_range("bitset string pos out of range");
747 size_t __rlen = std::min(__n, __str.size() - __pos);
748 __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
751 // 23.3.5.2 bitset operations:
752 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
753 bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
754 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
755 bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
756 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
757 bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
758 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
759 bitset& operator<<=(size_t __pos) _NOEXCEPT;
760 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
761 bitset& operator>>=(size_t __pos) _NOEXCEPT;
762 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
763 bitset& set() _NOEXCEPT;
764 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
765 bitset& set(size_t __pos, bool __val = true);
766 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
767 bitset& reset() _NOEXCEPT;
768 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
769 bitset& reset(size_t __pos);
770 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
771 bitset operator~() const _NOEXCEPT;
772 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
773 bitset& flip() _NOEXCEPT;
774 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
775 bitset& flip(size_t __pos);
778 #ifdef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
779 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator[](size_t __p) const {return base::__make_ref(__p);}
781 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
783 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 reference operator[](size_t __p) {return base::__make_ref(__p);}
784 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
785 unsigned long to_ulong() const;
786 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
787 unsigned long long to_ullong() const;
788 template <class _CharT, class _Traits, class _Allocator>
789 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
790 basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
791 _CharT __one = _CharT('1')) const;
792 template <class _CharT, class _Traits>
793 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
794 basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
795 _CharT __one = _CharT('1')) const;
796 template <class _CharT>
797 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
798 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
799 _CharT __one = _CharT('1')) const;
800 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
801 basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
802 char __one = '1') const;
803 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
804 size_t count() const _NOEXCEPT;
805 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
806 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
807 bool operator==(const bitset& __rhs) const _NOEXCEPT;
808 #if _LIBCPP_STD_VER <= 17
809 _LIBCPP_INLINE_VISIBILITY
810 bool operator!=(const bitset& __rhs) const _NOEXCEPT;
812 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
813 bool test(size_t __pos) const;
814 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
815 bool all() const _NOEXCEPT;
816 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
817 bool any() const _NOEXCEPT;
818 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool none() const _NOEXCEPT {return !any();}
819 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
820 bitset operator<<(size_t __pos) const _NOEXCEPT;
821 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
822 bitset operator>>(size_t __pos) const _NOEXCEPT;
825 template <class _CharT, class _Traits>
826 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
827 __init_from_string_view(basic_string_view<_CharT, _Traits> __str, _CharT __zero, _CharT __one) {
829 for (size_t __i = 0; __i < __str.size(); ++__i)
830 if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
831 std::__throw_invalid_argument("bitset string ctor has invalid argument");
833 size_t __mp = std::min(__str.size(), _Size);
835 for (; __i < __mp; ++__i) {
836 _CharT __c = __str[__mp - 1 - __i];
837 (*this)[__i] = _Traits::eq(__c, __one);
839 std::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
842 _LIBCPP_INLINE_VISIBILITY
843 size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
845 friend struct hash<bitset>;
848 template <size_t _Size>
850 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
852 bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
854 base::operator&=(__rhs);
858 template <size_t _Size>
860 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
862 bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
864 base::operator|=(__rhs);
868 template <size_t _Size>
870 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
872 bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
874 base::operator^=(__rhs);
878 template <size_t _Size>
879 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
881 bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT
883 __pos = _VSTD::min(__pos, _Size);
884 _VSTD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
885 _VSTD::fill_n(base::__make_iter(0), __pos, false);
889 template <size_t _Size>
890 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
892 bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
894 __pos = _VSTD::min(__pos, _Size);
895 _VSTD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
896 _VSTD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
900 template <size_t _Size>
902 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
904 bitset<_Size>::set() _NOEXCEPT
906 _VSTD::fill_n(base::__make_iter(0), _Size, true);
910 template <size_t _Size>
911 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
913 bitset<_Size>::set(size_t __pos, bool __val)
916 __throw_out_of_range("bitset set argument out of range");
918 (*this)[__pos] = __val;
922 template <size_t _Size>
924 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
926 bitset<_Size>::reset() _NOEXCEPT
928 _VSTD::fill_n(base::__make_iter(0), _Size, false);
932 template <size_t _Size>
933 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
935 bitset<_Size>::reset(size_t __pos)
938 __throw_out_of_range("bitset reset argument out of range");
940 (*this)[__pos] = false;
944 template <size_t _Size>
946 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
948 bitset<_Size>::operator~() const _NOEXCEPT
955 template <size_t _Size>
957 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
959 bitset<_Size>::flip() _NOEXCEPT
965 template <size_t _Size>
966 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
968 bitset<_Size>::flip(size_t __pos)
971 __throw_out_of_range("bitset flip argument out of range");
973 reference __r = base::__make_ref(__pos);
978 template <size_t _Size>
980 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
982 bitset<_Size>::to_ulong() const
984 return base::to_ulong();
987 template <size_t _Size>
989 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
991 bitset<_Size>::to_ullong() const
993 return base::to_ullong();
996 template <size_t _Size>
997 template <class _CharT, class _Traits, class _Allocator>
998 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
999 basic_string<_CharT, _Traits, _Allocator>
1000 bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
1002 basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero);
1003 for (size_t __i = 0; __i != _Size; ++__i)
1006 __r[_Size - 1 - __i] = __one;
1011 template <size_t _Size>
1012 template <class _CharT, class _Traits>
1014 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1015 basic_string<_CharT, _Traits, allocator<_CharT> >
1016 bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
1018 return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one);
1021 template <size_t _Size>
1022 template <class _CharT>
1024 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1025 basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
1026 bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
1028 return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one);
1031 template <size_t _Size>
1033 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1034 basic_string<char, char_traits<char>, allocator<char> >
1035 bitset<_Size>::to_string(char __zero, char __one) const
1037 return to_string<char, char_traits<char>, allocator<char> >(__zero, __one);
1040 template <size_t _Size>
1042 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1044 bitset<_Size>::count() const _NOEXCEPT
1046 return static_cast<size_t>(std::count(base::__make_iter(0), base::__make_iter(_Size), true));
1049 template <size_t _Size>
1051 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1053 bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
1055 return _VSTD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
1058 #if _LIBCPP_STD_VER <= 17
1060 template <size_t _Size>
1062 _LIBCPP_HIDE_FROM_ABI
1064 bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
1066 return !(*this == __rhs);
1071 template <size_t _Size>
1072 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1074 bitset<_Size>::test(size_t __pos) const
1077 __throw_out_of_range("bitset test argument out of range");
1079 return (*this)[__pos];
1082 template <size_t _Size>
1084 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1086 bitset<_Size>::all() const _NOEXCEPT
1091 template <size_t _Size>
1093 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1095 bitset<_Size>::any() const _NOEXCEPT
1100 template <size_t _Size>
1102 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1104 bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
1111 template <size_t _Size>
1113 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
1115 bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
1122 template <size_t _Size>
1123 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
1125 operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
1127 bitset<_Size> __r = __x;
1132 template <size_t _Size>
1133 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
1135 operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
1137 bitset<_Size> __r = __x;
1142 template <size_t _Size>
1143 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23
1145 operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
1147 bitset<_Size> __r = __x;
1152 template <size_t _Size>
1153 struct _LIBCPP_TEMPLATE_VIS hash<bitset<_Size> >
1154 : public __unary_function<bitset<_Size>, size_t>
1156 _LIBCPP_INLINE_VISIBILITY
1157 size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
1158 {return __bs.__hash_code();}
1161 template <class _CharT, class _Traits, size_t _Size>
1162 _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
1163 operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
1165 template <class _CharT, class _Traits, size_t _Size>
1166 _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
1167 operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
1169 _LIBCPP_END_NAMESPACE_STD
1173 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1174 # include <concepts>
1176 # include <type_traits>
1179 #endif // _LIBCPP_BITSET