44 #ifndef _GLIBCXX_BITSET
45 #define _GLIBCXX_BITSET 1
47 #pragma GCC system_header
55 #define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * __SIZEOF_LONG__)
56 #define _GLIBCXX_BITSET_WORDS(__n) \
57 ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \
58 ((__n) % _GLIBCXX_BITSET_BITS_PER_WORD == 0 ? 0 : 1))
60 #define _GLIBCXX_BITSET_BITS_PER_ULL (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
62 namespace std _GLIBCXX_VISIBILITY(default)
64 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
75 typedef unsigned long _WordT;
83 #ifdef __GXX_EXPERIMENTAL_CXX0X__
85 :
_M_w({ _WordT(__val)
86 #if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__
87 , _WordT(__val >> _GLIBCXX_BITSET_BITS_PER_WORD)
91 _Base_bitset(
unsigned long __val)
96 static _GLIBCXX_CONSTEXPR
size_t
97 _S_whichword(
size_t __pos )
98 {
return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
100 static _GLIBCXX_CONSTEXPR
size_t
101 _S_whichbyte(
size_t __pos )
102 {
return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
104 static _GLIBCXX_CONSTEXPR
size_t
105 _S_whichbit(
size_t __pos )
106 {
return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
108 static _GLIBCXX_CONSTEXPR _WordT
109 _S_maskbit(
size_t __pos )
110 {
return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
113 _M_getword(
size_t __pos)
114 {
return _M_w[_S_whichword(__pos)]; }
117 _M_getword(
size_t __pos)
const
118 {
return _M_w[_S_whichword(__pos)]; }
120 #ifdef __GXX_EXPERIMENTAL_CXX0X__
128 {
return _M_w[_Nw - 1]; }
130 _GLIBCXX_CONSTEXPR _WordT
132 {
return _M_w[_Nw - 1]; }
135 _M_do_and(
const _Base_bitset<_Nw>& __x)
137 for (
size_t __i = 0; __i < _Nw; __i++)
138 _M_w[__i] &= __x._M_w[__i];
142 _M_do_or(
const _Base_bitset<_Nw>& __x)
144 for (
size_t __i = 0; __i < _Nw; __i++)
145 _M_w[__i] |= __x._M_w[__i];
149 _M_do_xor(
const _Base_bitset<_Nw>& __x)
151 for (
size_t __i = 0; __i < _Nw; __i++)
152 _M_w[__i] ^= __x._M_w[__i];
156 _M_do_left_shift(
size_t __shift);
159 _M_do_right_shift(
size_t __shift);
164 for (
size_t __i = 0; __i < _Nw; __i++)
171 for (
size_t __i = 0; __i < _Nw; __i++)
172 _M_w[__i] = ~static_cast<_WordT>(0);
177 { __builtin_memset(
_M_w, 0, _Nw *
sizeof(_WordT)); }
180 _M_is_equal(
const _Base_bitset<_Nw>& __x)
const
182 for (
size_t __i = 0; __i < _Nw; ++__i)
183 if (
_M_w[__i] != __x._M_w[__i])
189 _M_are_all_aux()
const
191 for (
size_t __i = 0; __i < _Nw - 1; __i++)
192 if (
_M_w[__i] != ~static_cast<_WordT>(0))
194 return ((_Nw - 1) * _GLIBCXX_BITSET_BITS_PER_WORD
195 + __builtin_popcountl(_M_hiword()));
201 for (
size_t __i = 0; __i < _Nw; __i++)
202 if (
_M_w[__i] != static_cast<_WordT>(0))
211 for (
size_t __i = 0; __i < _Nw; __i++)
212 __result += __builtin_popcountl(
_M_w[__i]);
217 _M_do_to_ulong()
const;
219 #ifdef __GXX_EXPERIMENTAL_CXX0X__
221 _M_do_to_ullong()
const;
226 _M_do_find_first(
size_t __not_found)
const;
230 _M_do_find_next(
size_t __prev,
size_t __not_found)
const;
236 _Base_bitset<_Nw>::_M_do_left_shift(
size_t __shift)
238 if (__builtin_expect(__shift != 0, 1))
240 const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD;
241 const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD;
244 for (
size_t __n = _Nw - 1; __n >= __wshift; --__n)
245 _M_w[__n] = _M_w[__n - __wshift];
248 const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD
250 for (
size_t __n = _Nw - 1; __n > __wshift; --__n)
251 _M_w[__n] = ((_M_w[__n - __wshift] << __offset)
252 | (_M_w[__n - __wshift - 1] >> __sub_offset));
253 _M_w[__wshift] = _M_w[0] << __offset;
256 std::fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0));
262 _Base_bitset<_Nw>::_M_do_right_shift(
size_t __shift)
264 if (__builtin_expect(__shift != 0, 1))
266 const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD;
267 const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD;
268 const size_t __limit = _Nw - __wshift - 1;
271 for (
size_t __n = 0; __n <= __limit; ++__n)
272 _M_w[__n] = _M_w[__n + __wshift];
275 const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD
277 for (
size_t __n = 0; __n < __limit; ++__n)
278 _M_w[__n] = ((_M_w[__n + __wshift] >> __offset)
279 | (_M_w[__n + __wshift + 1] << __sub_offset));
280 _M_w[__limit] = _M_w[_Nw-1] >> __offset;
283 std::fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0));
289 _Base_bitset<_Nw>::_M_do_to_ulong()
const
291 for (
size_t __i = 1; __i < _Nw; ++__i)
293 __throw_overflow_error(__N(
"_Base_bitset::_M_do_to_ulong"));
297 #ifdef __GXX_EXPERIMENTAL_CXX0X__
300 _Base_bitset<_Nw>::_M_do_to_ullong()
const
302 const bool __dw =
sizeof(
unsigned long long) >
sizeof(
unsigned long);
303 for (
size_t __i = 1 + __dw; __i < _Nw; ++__i)
305 __throw_overflow_error(__N(
"_Base_bitset::_M_do_to_ullong"));
308 return _M_w[0] + (
static_cast<unsigned long long>(_M_w[1])
309 << _GLIBCXX_BITSET_BITS_PER_WORD);
316 _Base_bitset<_Nw>::_M_do_find_first(
size_t __not_found)
const
318 for (
size_t __i = 0; __i < _Nw; __i++)
320 _WordT __thisword = _M_w[__i];
321 if (__thisword != static_cast<_WordT>(0))
322 return (__i * _GLIBCXX_BITSET_BITS_PER_WORD
323 + __builtin_ctzl(__thisword));
331 _Base_bitset<_Nw>::_M_do_find_next(
size_t __prev,
size_t __not_found)
const
337 if (__prev >= _Nw * _GLIBCXX_BITSET_BITS_PER_WORD)
341 size_t __i = _S_whichword(__prev);
342 _WordT __thisword = _M_w[__i];
345 __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev);
347 if (__thisword != static_cast<_WordT>(0))
348 return (__i * _GLIBCXX_BITSET_BITS_PER_WORD
349 + __builtin_ctzl(__thisword));
353 for (; __i < _Nw; __i++)
355 __thisword = _M_w[__i];
356 if (__thisword != static_cast<_WordT>(0))
357 return (__i * _GLIBCXX_BITSET_BITS_PER_WORD
358 + __builtin_ctzl(__thisword));
370 struct _Base_bitset<1>
372 typedef unsigned long _WordT;
375 _GLIBCXX_CONSTEXPR _Base_bitset()
379 #ifdef __GXX_EXPERIMENTAL_CXX0X__
380 constexpr _Base_bitset(
unsigned long long __val)
382 _Base_bitset(
unsigned long __val)
387 static _GLIBCXX_CONSTEXPR
size_t
388 _S_whichword(
size_t __pos )
389 {
return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
391 static _GLIBCXX_CONSTEXPR
size_t
392 _S_whichbyte(
size_t __pos )
393 {
return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
395 static _GLIBCXX_CONSTEXPR
size_t
396 _S_whichbit(
size_t __pos )
397 {
return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
399 static _GLIBCXX_CONSTEXPR _WordT
400 _S_maskbit(
size_t __pos )
401 {
return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
408 _M_getword(
size_t)
const
411 #ifdef __GXX_EXPERIMENTAL_CXX0X__
421 _GLIBCXX_CONSTEXPR _WordT
427 {
_M_w &= __x._M_w; }
431 {
_M_w |= __x._M_w; }
435 {
_M_w ^= __x._M_w; }
438 _M_do_left_shift(
size_t __shift)
439 {
_M_w <<= __shift; }
442 _M_do_right_shift(
size_t __shift)
443 {
_M_w >>= __shift; }
451 {
_M_w = ~static_cast<_WordT>(0); }
459 {
return _M_w == __x._M_w; }
462 _M_are_all_aux()
const
463 {
return __builtin_popcountl(
_M_w); }
467 {
return _M_w != 0; }
471 {
return __builtin_popcountl(
_M_w); }
474 _M_do_to_ulong()
const
477 #ifdef __GXX_EXPERIMENTAL_CXX0X__
479 _M_do_to_ullong()
const
484 _M_do_find_first(
size_t __not_found)
const
487 return __builtin_ctzl(
_M_w);
494 _M_do_find_next(
size_t __prev,
size_t __not_found)
const
497 if (__prev >= ((
size_t) _GLIBCXX_BITSET_BITS_PER_WORD))
500 _WordT __x =
_M_w >> __prev;
502 return __builtin_ctzl(__x) + __prev;
514 struct _Base_bitset<0>
516 typedef unsigned long _WordT;
518 _GLIBCXX_CONSTEXPR _Base_bitset()
521 #ifdef __GXX_EXPERIMENTAL_CXX0X__
522 constexpr _Base_bitset(
unsigned long long)
524 _Base_bitset(
unsigned long)
528 static _GLIBCXX_CONSTEXPR
size_t
529 _S_whichword(
size_t __pos )
530 {
return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
532 static _GLIBCXX_CONSTEXPR
size_t
533 _S_whichbyte(
size_t __pos )
534 {
return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
536 static _GLIBCXX_CONSTEXPR
size_t
537 _S_whichbit(
size_t __pos )
538 {
return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
540 static _GLIBCXX_CONSTEXPR _WordT
541 _S_maskbit(
size_t __pos )
542 {
return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
554 __throw_out_of_range(__N(
"_Base_bitset::_M_getword"));
559 _M_getword(
size_t __pos)
const
562 _GLIBCXX_CONSTEXPR _WordT
579 _M_do_left_shift(
size_t)
583 _M_do_right_shift(
size_t)
606 _M_are_all_aux()
const
618 _M_do_to_ulong()
const
621 #ifdef __GXX_EXPERIMENTAL_CXX0X__
623 _M_do_to_ullong()
const
630 _M_do_find_first(
size_t)
const
634 _M_do_find_next(
size_t,
size_t)
const
640 template<
size_t _Extrabits>
643 typedef unsigned long _WordT;
646 _S_do_sanitize(_WordT& __val)
647 { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); }
653 typedef unsigned long _WordT;
656 _S_do_sanitize(_WordT) { }
659 #ifdef __GXX_EXPERIMENTAL_CXX0X__
660 template<
size_t _Nb,
bool = _Nb < _GLIBCXX_BITSET_BITS_PER_ULL>
663 static constexpr
unsigned long long
664 _S_do_sanitize_val(
unsigned long long __val)
669 struct _Sanitize_val<_Nb, true>
671 static constexpr
unsigned long long
672 _S_do_sanitize_val(
unsigned long long __val)
673 {
return __val & ~((~static_cast<
unsigned long long>(0)) << _Nb); }
743 :
private _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)>
746 typedef _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> _Base;
747 typedef unsigned long _WordT;
752 typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type;
753 __sanitize_type::_S_do_sanitize(this->_M_hiword());
756 #ifdef __GXX_EXPERIMENTAL_CXX0X__
757 template<
typename>
friend class hash;
784 reference(bitset& __b,
size_t __pos)
786 _M_wp = &__b._M_getword(__pos);
787 _M_bpos = _Base::_S_whichbit(__pos);
798 *_M_wp |= _Base::_S_maskbit(_M_bpos);
800 *_M_wp &= ~_Base::_S_maskbit(_M_bpos);
806 operator=(
const reference& __j)
808 if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)))
809 *_M_wp |= _Base::_S_maskbit(_M_bpos);
811 *_M_wp &= ~_Base::_S_maskbit(_M_bpos);
818 {
return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; }
821 operator bool()
const
822 {
return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; }
828 *_M_wp ^= _Base::_S_maskbit(_M_bpos);
832 friend class reference;
836 _GLIBCXX_CONSTEXPR bitset()
840 #ifdef __GXX_EXPERIMENTAL_CXX0X__
841 constexpr bitset(
unsigned long long __val)
842 : _Base(_Sanitize_val<_Nb>::_S_do_sanitize_val(__val)) { }
844 bitset(
unsigned long __val)
846 { _M_do_sanitize(); }
858 template<
class _CharT,
class _Traits,
class _Alloc>
861 size_t __position = 0)
864 if (__position > __s.
size())
865 __throw_out_of_range(__N(
"bitset::bitset initial position "
867 _M_copy_from_string(__s, __position,
869 _CharT(
'0'), _CharT(
'1'));
881 template<
class _CharT,
class _Traits,
class _Alloc>
883 size_t __position,
size_t __n)
886 if (__position > __s.
size())
887 __throw_out_of_range(__N(
"bitset::bitset initial position "
889 _M_copy_from_string(__s, __position, __n, _CharT(
'0'), _CharT(
'1'));
894 template<
class _CharT,
class _Traits,
class _Alloc>
896 size_t __position,
size_t __n,
897 _CharT __zero, _CharT __one = _CharT(
'1'))
900 if (__position > __s.
size())
901 __throw_out_of_range(__N(
"bitset::bitset initial position "
903 _M_copy_from_string(__s, __position, __n, __zero, __one);
906 #ifdef __GXX_EXPERIMENTAL_CXX0X__
916 template<
typename _CharT>
918 bitset(
const _CharT* __str,
919 typename std::basic_string<_CharT>::size_type __n
921 _CharT __zero = _CharT(
'0'), _CharT __one = _CharT(
'1'))
925 __throw_logic_error(__N(
"bitset::bitset(const _CharT*, ...)"));
929 _M_copy_from_ptr<_CharT, std::char_traits<_CharT>>(__str, __n, 0,
944 operator&=(
const bitset<_Nb>& __rhs)
946 this->_M_do_and(__rhs);
951 operator|=(
const bitset<_Nb>& __rhs)
953 this->_M_do_or(__rhs);
958 operator^=(
const bitset<_Nb>& __rhs)
960 this->_M_do_xor(__rhs);
975 if (__builtin_expect(__position < _Nb, 1))
977 this->_M_do_left_shift(__position);
978 this->_M_do_sanitize();
988 if (__builtin_expect(__position < _Nb, 1))
990 this->_M_do_right_shift(__position);
991 this->_M_do_sanitize();
1008 this->_M_getword(__pos) |= _Base::_S_maskbit(__pos);
1016 this->_M_getword(__pos) |= _Base::_S_maskbit(__pos);
1018 this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos);
1025 this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos);
1032 this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos);
1038 {
return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos))
1039 != static_cast<_WordT>(0)); }
1050 this->_M_do_sanitize();
1061 set(
size_t __position,
bool __val =
true)
1063 if (__position >= _Nb)
1064 __throw_out_of_range(__N(
"bitset::set"));
1074 this->_M_do_reset();
1088 if (__position >= _Nb)
1089 __throw_out_of_range(__N(
"bitset::reset"));
1100 this->_M_do_sanitize();
1112 if (__position >= _Nb)
1113 __throw_out_of_range(__N(
"bitset::flip"));
1120 {
return bitset<_Nb>(*this).flip(); }
1139 {
return reference(*
this, __position); }
1154 {
return this->_M_do_to_ulong(); }
1156 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1159 {
return this->_M_do_to_ullong(); }
1170 template<
class _CharT,
class _Traits,
class _Alloc>
1175 _M_copy_to_string(__result, _CharT(
'0'), _CharT(
'1'));
1181 template<
class _CharT,
class _Traits,
class _Alloc>
1183 to_string(_CharT __zero, _CharT __one = _CharT(
'1'))
const
1186 _M_copy_to_string(__result, __zero, __one);
1192 template<
class _CharT,
class _Traits>
1195 {
return to_string<_CharT, _Traits, std::allocator<_CharT> >(); }
1199 template<
class _CharT,
class _Traits>
1201 to_string(_CharT __zero, _CharT __one = _CharT(
'1'))
const
1205 template<
class _CharT>
1210 return to_string<_CharT, std::char_traits<_CharT>,
1214 template<
class _CharT>
1217 to_string(_CharT __zero, _CharT __one = _CharT(
'1'))
const
1219 return to_string<_CharT, std::char_traits<_CharT>,
1226 return to_string<char, std::char_traits<char>,
1231 to_string(
char __zero,
char __one =
'1')
const
1233 return to_string<char, std::char_traits<char>,
1238 template<
class _CharT,
class _Traits>
1240 _M_copy_from_ptr(
const _CharT*,
size_t,
size_t,
size_t,
1243 template<
class _CharT,
class _Traits,
class _Alloc>
1246 _Traits, _Alloc>& __s,
size_t __pos,
size_t __n,
1247 _CharT __zero, _CharT __one)
1248 { _M_copy_from_ptr<_CharT, _Traits>(__s.
data(), __s.
size(), __pos, __n,
1251 template<
class _CharT,
class _Traits,
class _Alloc>
1254 _CharT, _CharT)
const;
1257 template<
class _CharT,
class _Traits,
class _Alloc>
1260 _Traits, _Alloc>& __s,
size_t __pos,
size_t __n)
1261 { _M_copy_from_string(__s, __pos, __n, _CharT(
'0'), _CharT(
'1')); }
1263 template<
class _CharT,
class _Traits,
class _Alloc>
1266 { _M_copy_to_string(__s, _CharT(
'0'), _CharT(
'1')); }
1271 {
return this->_M_do_count(); }
1274 _GLIBCXX_CONSTEXPR
size_t
1282 {
return this->_M_is_equal(__rhs); }
1286 {
return !this->_M_is_equal(__rhs); }
1298 if (__position >= _Nb)
1299 __throw_out_of_range(__N(
"bitset::test"));
1311 {
return this->_M_are_all_aux() == _Nb; }
1319 {
return this->_M_is_any(); }
1327 {
return !this->_M_is_any(); }
1333 {
return bitset<_Nb>(*this) <<= __position; }
1337 {
return bitset<_Nb>(*this) >>= __position; }
1348 {
return this->_M_do_find_first(_Nb); }
1359 {
return this->_M_do_find_next(__prev, _Nb); }
1363 template<
size_t _Nb>
1364 template<
class _CharT,
class _Traits>
1367 _M_copy_from_ptr(
const _CharT* __s,
size_t __len,
1368 size_t __pos,
size_t __n, _CharT __zero, _CharT __one)
1372 for (
size_t __i = __nbits; __i > 0; --__i)
1374 const _CharT __c = __s[__pos + __nbits - __i];
1375 if (_Traits::eq(__c, __zero))
1377 else if (_Traits::eq(__c, __one))
1380 __throw_invalid_argument(__N(
"bitset::_M_copy_from_ptr"));
1384 template<
size_t _Nb>
1385 template<
class _CharT,
class _Traits,
class _Alloc>
1389 _CharT __zero, _CharT __one)
const
1392 for (
size_t __i = _Nb; __i > 0; --__i)
1394 _Traits::assign(__s[_Nb - __i], __one);
1407 template<
size_t _Nb>
1411 bitset<_Nb> __result(__x);
1416 template<
size_t _Nb>
1420 bitset<_Nb> __result(__x);
1425 template <
size_t _Nb>
1429 bitset<_Nb> __result(__x);
1444 template<
class _CharT,
class _Traits,
size_t _Nb>
1448 typedef typename _Traits::char_type char_type;
1450 typedef typename __istream_type::ios_base __ios_base;
1457 const char_type __zero = __is.
widen(
'0');
1458 const char_type __one = __is.
widen(
'1');
1460 typename __ios_base::iostate __state = __ios_base::goodbit;
1461 typename __istream_type::sentry __sentry(__is);
1466 for (
size_t __i = _Nb; __i > 0; --__i)
1468 static typename _Traits::int_type __eof = _Traits::eof();
1470 typename _Traits::int_type __c1 = __is.
rdbuf()->sbumpc();
1471 if (_Traits::eq_int_type(__c1, __eof))
1473 __state |= __ios_base::eofbit;
1478 const char_type __c2 = _Traits::to_char_type(__c1);
1479 if (_Traits::eq(__c2, __zero))
1481 else if (_Traits::eq(__c2, __one))
1484 eq_int_type(__is.
rdbuf()->sputbackc(__c2),
1487 __state |= __ios_base::failbit;
1495 __is._M_setstate(__ios_base::badbit);
1496 __throw_exception_again;
1499 { __is._M_setstate(__ios_base::badbit); }
1502 if (__tmp.
empty() && _Nb)
1503 __state |= __ios_base::failbit;
1505 __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb,
1512 template <
class _CharT,
class _Traits,
size_t _Nb>
1514 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1515 const bitset<_Nb>& __x)
1521 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__os.getloc());
1522 __x._M_copy_to_string(__tmp, __ct.
widen(
'0'), __ct.
widen(
'1'));
1523 return __os << __tmp;
1527 _GLIBCXX_END_NAMESPACE_CONTAINER
1530 #undef _GLIBCXX_BITSET_WORDS
1531 #undef _GLIBCXX_BITSET_BITS_PER_WORD
1532 #undef _GLIBCXX_BITSET_BITS_PER_ULL
1534 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1538 namespace std _GLIBCXX_VISIBILITY(default)
1540 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1544 template<
size_t _Nb>
1545 struct hash<_GLIBCXX_STD_C::bitset<_Nb>>
1546 :
public __hash_base<size_t, _GLIBCXX_STD_C::bitset<_Nb>>
1549 operator()(
const _GLIBCXX_STD_C::bitset<_Nb>& __b)
const
1551 const size_t __clength = (_Nb + __CHAR_BIT__ - 1) / __CHAR_BIT__;
1552 return std::_Hash_impl::hash(__b._M_getdata(), __clength);
1557 struct hash<_GLIBCXX_STD_C::bitset<0>>
1558 :
public __hash_base<size_t, _GLIBCXX_STD_C::bitset<0>>
1561 operator()(
const _GLIBCXX_STD_C::bitset<0>&)
const
1565 _GLIBCXX_END_NAMESPACE_VERSION
1568 #endif // __GXX_EXPERIMENTAL_CXX0X__
1570 #ifdef _GLIBCXX_DEBUG
1574 #ifdef _GLIBCXX_PROFILE
bitset< _Nb > & set()
Sets every bit to true.
Basis for explicit traits specializations.
void push_back(_CharT __c)
Append a single character.
reference operator[](size_t __position)
Array-indexing support.
Controlling output.This is the base class for all output streams. It provides text formatting of all ...
bitset< _Nb > & _Unchecked_set(size_t __pos)
bitset< _Nb > & operator>>=(size_t __position)
Operations on bitsets.
_WordT _M_w[_Nw]
0 is the least significant word.
bitset< _Nb > operator<<(size_t __position) const
Self-explanatory.
const _CharT * data() const
Return const pointer to contents.
bool _Unchecked_test(size_t __pos) const
Primary class template ctype facet.This template class defines classification and conversion function...
bool test(size_t __position) const
Tests the value of a bit.
bitset< _Nb > operator>>(size_t __position) const
Self-explanatory.
bitset< _Nb > & _Unchecked_reset(size_t __pos)
Controlling input.This is the base class for all input streams. It provides text formatting of all bu...
char_type widen(char __c) const
Widen char to char_type.
bool all() const
Tests whether all the bits are on.
Primary class template hash.
bool operator!=(const bitset< _Nb > &__rhs) const
These comparisons for equality/inequality are, well, bitwise.
size_t _Find_first() const
Finds the index of the first "on" bit.
std::basic_string< _CharT, _Traits, _Alloc > to_string() const
Returns a character interpretation of the bitset.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
constexpr size_t size() const
Returns the total number of bits.
bitset< _Nb > & reset()
Sets every bit to false.
size_type size() const
Returns the number of characters in the string, not including any null-termination.
Managing sequences of characters and character-like objects.
bitset< _Nb > & operator<<=(size_t __position)
Operations on bitsets.
size_t _Find_next(size_t __prev) const
Finds the index of the next "on" bit after prev.
bitset< _Nb > operator~() const
See the no-argument flip().
bitset< _Nb > & _Unchecked_flip(size_t __pos)
bitset< _Nb > & flip()
Toggles every bit to its opposite value.
bitset< _Nb > operator&(const bitset< _Nb > &__x, const bitset< _Nb > &__y)
Global bitwise operations on bitsets.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y)
Global bitwise operations on bitsets.
bool any() const
Tests whether any of the bits are on.
void setstate(iostate __state)
Sets additional flags in the error state.
size_t count() const
Returns the number of bits which are set.
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
bool none() const
Tests whether any of the bits are on.
bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y)
Global bitwise operations on bitsets.
The standard allocator, as per [20.4].Further details: http://gcc.gnu.org/onlinedocs/libstdc++/manual...
basic_string & assign(const basic_string &__str)
Set value to contents of another string.
Thrown as part of forced unwinding.A magic placeholder class that can be caught by reference to recog...
unsigned long to_ulong() const
Returns a numerical interpretation of the bitset.
char_type widen(char __c) const
Widens characters.
bool operator==(const bitset< _Nb > &__rhs) const
These comparisons for equality/inequality are, well, bitwise.