29 #ifndef _GLIBCXX_PROFILE_BITSET
30 #define _GLIBCXX_PROFILE_BITSET
34 namespace std _GLIBCXX_VISIBILITY(default)
41 :
public _GLIBCXX_STD_C::bitset<_Nb>
43 typedef _GLIBCXX_STD_C::bitset<_Nb>
_Base;
48 :
private _Base::reference
50 typedef typename _Base::reference _Base_ref;
55 reference(
const _Base_ref&
__base,
bitset* __seq) _GLIBCXX_NOEXCEPT
60 reference(
const reference& __x) _GLIBCXX_NOEXCEPT
65 operator=(
bool __x) _GLIBCXX_NOEXCEPT
67 *
static_cast<_Base_ref*
>(
this) = __x;
72 operator=(
const reference& __x) _GLIBCXX_NOEXCEPT
74 *
static_cast<_Base_ref*
>(
this) = __x;
81 return ~(*
static_cast<const _Base_ref*
>(
this));
84 operator bool()
const _GLIBCXX_NOEXCEPT
86 return *
static_cast<const _Base_ref*
>(
this);
90 flip() _GLIBCXX_NOEXCEPT
98 _GLIBCXX_CONSTEXPR
bitset() _GLIBCXX_NOEXCEPT
101 #ifdef __GXX_EXPERIMENTAL_CXX0X__
102 constexpr
bitset(
unsigned long long __val) noexcept
104 bitset(
unsigned long __val)
108 template<
typename _CharT,
typename _Traits,
typename _Alloc>
111 typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
113 typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
115 :
_Base(__str, __pos, __n) { }
119 template<
class _CharT,
class _Traits,
class _Alloc>
121 typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
123 typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
125 _CharT __zero, _CharT __one = _CharT(
'1'))
126 :
_Base(__str, __pos, __n, __zero, __one) { }
130 #ifdef __GXX_EXPERIMENTAL_CXX0X__
131 template<
typename _CharT>
133 bitset(
const _CharT* __str,
134 typename std::basic_string<_CharT>::size_type __n
136 _CharT __zero = _CharT(
'0'), _CharT __one = _CharT(
'1'))
137 :
_Base(__str, __n, __zero, __one) { }
142 operator&=(
const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
149 operator|=(
const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
156 operator^=(
const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
177 set() _GLIBCXX_NOEXCEPT
186 set(
size_t __pos,
bool __val =
true)
193 reset() _GLIBCXX_NOEXCEPT
208 {
return bitset(~_M_base()); }
211 flip() _GLIBCXX_NOEXCEPT
230 return reference(_M_base()[__pos],
this);
235 _GLIBCXX_CONSTEXPR
bool
242 #ifdef __GXX_EXPERIMENTAL_CXX0X__
243 using _Base::to_ullong;
246 template <
typename _CharT,
typename _Traits,
typename _Alloc>
249 {
return _M_base().template to_string<_CharT, _Traits, _Alloc>(); }
253 template<
class _CharT,
class _Traits,
class _Alloc>
255 to_string(_CharT __zero, _CharT __one = _CharT(
'1'))
const
257 return _M_base().template
258 to_string<_CharT, _Traits, _Alloc>(__zero, __one);
263 template<
typename _CharT,
typename _Traits>
266 {
return to_string<_CharT, _Traits, std::allocator<_CharT> >(); }
270 template<
class _CharT,
class _Traits>
272 to_string(_CharT __zero, _CharT __one = _CharT(
'1'))
const
276 template<
typename _CharT>
281 return to_string<_CharT, std::char_traits<_CharT>,
285 template<
class _CharT>
288 to_string(_CharT __zero, _CharT __one = _CharT(
'1'))
const
290 return to_string<_CharT, std::char_traits<_CharT>,
301 to_string(
char __zero,
char __one =
'1')
const
303 return to_string<char, std::char_traits<char>,
311 operator==(
const bitset<_Nb>& __rhs)
const _GLIBCXX_NOEXCEPT
312 {
return _M_base() == __rhs; }
315 operator!=(
const bitset<_Nb>& __rhs)
const _GLIBCXX_NOEXCEPT
316 {
return _M_base() != __rhs; }
324 operator<<(
size_t __pos)
const _GLIBCXX_NOEXCEPT
328 operator>>(
size_t __pos)
const _GLIBCXX_NOEXCEPT
332 _M_base() _GLIBCXX_NOEXCEPT
336 _M_base()
const _GLIBCXX_NOEXCEPT
347 operator|(
const bitset<_Nb>& __x,
const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
348 {
return bitset<_Nb>(__x) |= __y; }
352 operator^(
const bitset<_Nb>& __x,
const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
353 {
return bitset<_Nb>(__x) ^= __y; }
355 template<
typename _CharT,
typename _Traits,
size_t _Nb>
358 {
return __is >> __x._M_base(); }
360 template<
typename _CharT,
typename _Traits,
size_t _Nb>
362 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
363 const bitset<_Nb>& __x)
364 {
return __os << __x._M_base(); }
367 #ifdef __GXX_EXPERIMENTAL_CXX0X__
371 struct hash<__profile::bitset<_Nb>>
372 :
public __hash_base<size_t, __profile::bitset<_Nb>>
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
bool test(size_t __position) const
Tests the value of a bit.
The standard allocator, as per [20.4].
bitset< _Nb > & flip() _GLIBCXX_NOEXCEPT
Toggles every bit to its opposite value.
bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) _GLIBCXX_NOEXCEPT
Global bitwise operations on bitsets.
Template class basic_ostream.This is the base class for all output streams. It provides text formatti...
std::basic_string< _CharT, _Traits, _Alloc > to_string() const
Returns a character interpretation of the bitset.
bitset< _Nb > operator~() const _GLIBCXX_NOEXCEPT
See the no-argument flip().
size_t count() const _GLIBCXX_NOEXCEPT
Returns the number of bits which are set.
bool all() const _GLIBCXX_NOEXCEPT
Tests whether all the bits are on.
bool none() const _GLIBCXX_NOEXCEPT
Tests whether any of the bits are on.
unsigned long to_ulong() const
Returns a numerical interpretation of the bitset.
Template class basic_istream.This is the base class for all input streams. It provides text formattin...
reference operator[](size_t __position)
Array-indexing support.
bitset< _Nb > & operator>>=(size_t __position) _GLIBCXX_NOEXCEPT
Managing sequences of characters and character-like objects.
bitset< _Nb > & reset() _GLIBCXX_NOEXCEPT
Sets every bit to false.
bitset< _Nb > & operator<<=(size_t __position) _GLIBCXX_NOEXCEPT
bool any() const _GLIBCXX_NOEXCEPT
Tests whether any of the bits are on.
bitset< _Nb > operator>>(size_t __position) const _GLIBCXX_NOEXCEPT
Self-explanatory.
bitset< _Nb > operator&(const bitset< _Nb > &__x, const bitset< _Nb > &__y) _GLIBCXX_NOEXCEPT
Global bitwise operations on bitsets.
bitset< _Nb > & set() _GLIBCXX_NOEXCEPT
Sets every bit to true.
Primary class template hash.
Class std::bitset wrapper with performance instrumentation.
constexpr size_t size() const _GLIBCXX_NOEXCEPT
Returns the total number of bits.