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 #if __cplusplus >= 201103L
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 #if __cplusplus >= 201103L
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 #if __cplusplus >= 201103L
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 #if __cplusplus >= 201103L
371 struct hash<__profile::bitset<_Nb>>
372 :
public __hash_base<size_t, __profile::bitset<_Nb>>
bitset< _Nb > operator~() const noexcept
See the no-argument flip().
bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
Class std::bitset wrapper with performance instrumentation.
bitset< _Nb > & flip() noexcept
Toggles every bit to its opposite value.
Template class basic_istream.
bool test(size_t __position) const
Tests the value of a bit.
bitset< _Nb > & reset() noexcept
Sets every bit to false.
constexpr size_t size() const noexcept
Returns the total number of bits.
bitset< _Nb > & operator<<=(size_t __position) noexcept
bool all() const noexcept
Tests whether all the bits are on.
bitset< _Nb > operator<<(size_t __position) const noexcept
Self-explanatory.
size_t count() const noexcept
Returns the number of bits which are set.
unsigned long to_ulong() const
Returns a numerical interpretation of the bitset.
bitset< _Nb > & set() noexcept
Sets every bit to true.
bitset< _Nb > & operator>>=(size_t __position) noexcept
bool any() const noexcept
Tests whether any of the bits are on.
std::basic_string< _CharT, _Traits, _Alloc > to_string() const
Returns a character interpretation of the bitset.
The standard allocator, as per [20.4].
bool none() const noexcept
Tests whether any of the bits are on.
bitset< _Nb > operator>>(size_t __position) const noexcept
Self-explanatory.
bitset< _Nb > operator&(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
Managing sequences of characters and character-like objects.
Template class basic_ostream.
Primary class template hash.
bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
reference operator[](size_t __position)
Array-indexing support.