30 #ifndef _GLIBCXX_DEBUG_BITSET
31 #define _GLIBCXX_DEBUG_BITSET
37 namespace std _GLIBCXX_VISIBILITY(default)
44 :
public _GLIBCXX_STD_C::bitset<_Nb>
45 #ifndef __GXX_EXPERIMENTAL_CXX0X__
49 typedef _GLIBCXX_STD_C::bitset<_Nb>
_Base;
55 #ifdef __GXX_EXPERIMENTAL_CXX0X__
56 typedef typename _Base::reference reference;
60 :
private _Base::reference
63 typedef typename _Base::reference _Base_ref;
68 reference(
const _Base_ref&
__base,
69 bitset* __seq __attribute__((__unused__)))
71 , _Safe_iterator_base(__seq,
false)
75 reference(
const reference& __x)
77 , _Safe_iterator_base(__x,
false)
84 _M_message(__gnu_debug::__msg_bad_bitset_write)
86 *
static_cast<_Base_ref*
>(
this) = __x;
91 operator=(
const reference& __x)
94 _M_message(__gnu_debug::__msg_bad_bitset_read)
97 _M_message(__gnu_debug::__msg_bad_bitset_write)
99 *
static_cast<_Base_ref*
>(
this) = __x;
107 _M_message(__gnu_debug::__msg_bad_bitset_read)
108 ._M_iterator(*
this));
109 return ~(*
static_cast<const _Base_ref*
>(
this));
112 operator bool()
const
115 _M_message(__gnu_debug::__msg_bad_bitset_read)
116 ._M_iterator(*
this));
117 return *
static_cast<const _Base_ref*
>(
this);
124 _M_message(__gnu_debug::__msg_bad_bitset_flip)
125 ._M_iterator(*
this));
135 #ifdef __GXX_EXPERIMENTAL_CXX0X__
136 constexpr bitset(
unsigned long long __val)
138 bitset(
unsigned long __val)
142 template<
typename _CharT,
typename _Traits,
typename _Alloc>
145 typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
147 typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
149 :
_Base(__str, __pos, __n) { }
153 template<
class _CharT,
class _Traits,
class _Alloc>
155 typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
157 typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
159 _CharT __zero, _CharT __one = _CharT(
'1'))
160 :
_Base(__str, __pos, __n, __zero, __one) { }
164 #ifdef __GXX_EXPERIMENTAL_CXX0X__
165 template<
typename _CharT>
167 bitset(
const _CharT* __str,
168 typename std::basic_string<_CharT>::size_type __n
170 _CharT __zero = _CharT(
'0'), _CharT __one = _CharT(
'1'))
171 :
_Base(__str, __n, __zero, __one) { }
220 set(
size_t __pos,
bool __val =
true)
262 __glibcxx_check_subscript(__pos);
263 #ifdef __GXX_EXPERIMENTAL_CXX0X__
264 return _M_base()[__pos];
266 return reference(_M_base()[__pos],
this);
275 __glibcxx_check_subscript(__pos);
276 return _M_base()[__pos];
280 #ifdef __GXX_EXPERIMENTAL_CXX0X__
281 using _Base::to_ullong;
284 template <
typename _CharT,
typename _Traits,
typename _Alloc>
287 {
return _M_base().template to_string<_CharT, _Traits, _Alloc>(); }
291 template<
class _CharT,
class _Traits,
class _Alloc>
293 to_string(_CharT __zero, _CharT __one = _CharT(
'1'))
const
295 return _M_base().template
296 to_string<_CharT, _Traits, _Alloc>(__zero, __one);
301 template<
typename _CharT,
typename _Traits>
304 {
return to_string<_CharT, _Traits, std::allocator<_CharT> >(); }
308 template<
class _CharT,
class _Traits>
310 to_string(_CharT __zero, _CharT __one = _CharT(
'1'))
const
314 template<
typename _CharT>
319 return to_string<_CharT, std::char_traits<_CharT>,
323 template<
class _CharT>
326 to_string(_CharT __zero, _CharT __one = _CharT(
'1'))
const
328 return to_string<_CharT, std::char_traits<_CharT>,
339 to_string(
char __zero,
char __one =
'1')
const
341 return to_string<char, std::char_traits<char>,
350 {
return _M_base() == __rhs; }
354 {
return _M_base() != __rhs; }
362 operator<<(
size_t __pos)
const
366 operator>>(
size_t __pos)
const
370 _M_base() {
return *
this; }
373 _M_base()
const {
return *
this; }
383 operator|(
const bitset<_Nb>& __x,
const bitset<_Nb>& __y)
384 {
return bitset<_Nb>(__x) |= __y; }
388 operator^(
const bitset<_Nb>& __x,
const bitset<_Nb>& __y)
389 {
return bitset<_Nb>(__x) ^= __y; }
391 template<
typename _CharT,
typename _Traits,
size_t _Nb>
394 {
return __is >> __x._M_base(); }
396 template<
typename _CharT,
typename _Traits,
size_t _Nb>
398 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
399 const bitset<_Nb>& __x)
400 {
return __os << __x._M_base(); }
404 #ifdef __GXX_EXPERIMENTAL_CXX0X__
408 struct hash<__debug::bitset<_Nb>>
409 :
public __hash_base<size_t, __debug::bitset<_Nb>>
bitset< _Nb > & set()
Sets every bit to true.
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 > & operator>>=(size_t __position)
Operations on bitsets.
bool test(size_t __position) const
Tests the value of a bit.
bitset< _Nb > operator>>(size_t __position) const
Self-explanatory.
Class std::bitset with additional safety/checking/debug instrumentation.
Controlling input.This is the base class for all input streams. It provides text formatting of all bu...
bool all() const
Tests whether all the bits are on.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
Primary class template hash.
Base class that supports tracking of iterators that reference a sequence.
std::basic_string< _CharT, _Traits, _Alloc > to_string() const
Returns a character interpretation of the bitset.
constexpr size_t size() const
Returns the total number of bits.
bitset< _Nb > & reset()
Sets every bit to false.
Managing sequences of characters and character-like objects.
bitset< _Nb > & operator<<=(size_t __position)
Operations on bitsets.
bitset< _Nb > operator~() const
See the no-argument flip().
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.
#define _GLIBCXX_DEBUG_VERIFY(_Condition, _ErrorMessage)
bool any() const
Tests whether any of the bits are on.
size_t count() const
Returns the number of bits which are set.
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...
unsigned long to_ulong() const
Returns a numerical interpretation of the bitset.
Basic functionality for a safe iterator.