30#ifndef _GLIBCXX_TR2_DYNAMIC_BITSET_TCC
31#define _GLIBCXX_TR2_DYNAMIC_BITSET_TCC 1
34#pragma GCC system_header
44 template<
typename _WordT,
typename _Alloc>
48 if (__builtin_expect(__shift != 0, 1))
54 for (
size_t __n = this->
_M_w.size() - 1; __n >= __wshift; --__n)
55 this->
_M_w[__n] = this->
_M_w[__n - __wshift];
59 for (
size_t __n =
_M_w.size() - 1; __n > __wshift; --__n)
61 | (this->
_M_w[__n - __wshift - 1] >> __sub_offset));
69 template<
typename _WordT,
typename _Alloc>
73 if (__builtin_expect(__shift != 0, 1))
77 const size_t __limit = this->
_M_w.size() - __wshift - 1;
80 for (
size_t __n = 0; __n <= __limit; ++__n)
81 this->
_M_w[__n] = this->
_M_w[__n + __wshift];
86 for (
size_t __n = 0; __n < __limit; ++__n)
88 | (this->
_M_w[__n + __wshift + 1] << __sub_offset));
96 template<
typename _WordT,
typename _Alloc>
100 size_t __n =
sizeof(
unsigned long) /
sizeof(
block_type);
101 for (
size_t __i = __n; __i < this->
_M_w.size(); ++__i)
104 unsigned long __res = 0UL;
105 for (
size_t __i = 0; __i < __n && __i < this->
_M_w.size(); ++__i)
110 template<
typename _WordT,
typename _Alloc>
114 size_t __n =
sizeof(
unsigned long long) /
sizeof(
block_type);
115 for (
size_t __i = __n; __i < this->
_M_w.size(); ++__i)
118 unsigned long long __res = 0ULL;
119 for (
size_t __i = 0; __i < __n && __i < this->
_M_w.size(); ++__i)
124 template<
typename _WordT,
typename _Alloc>
129 for (
size_t __i = 0; __i < this->
_M_w.size(); ++__i)
131 _WordT __thisword = this->
_M_w[__i];
132 if (__thisword !=
static_cast<_WordT
>(0))
134 + __builtin_ctzll(__thisword));
140 template<
typename _WordT,
typename _Alloc>
154 _WordT __thisword = this->
_M_w[__i];
157 __thisword &= (~static_cast<_WordT>(0)) <<
_S_whichbit(__prev);
159 if (__thisword !=
static_cast<_WordT
>(0))
161 + __builtin_ctzll(__thisword));
164 for (++__i; __i < this->
_M_w.size(); ++__i)
166 __thisword = this->
_M_w[__i];
167 if (__thisword !=
static_cast<_WordT
>(0))
169 + __builtin_ctzll(__thisword));
176 template<
typename _WordT,
typename _Alloc>
177 template<
typename _Traits,
typename _CharT>
181 size_t __pos,
size_t __n, _CharT __zero, _CharT __one)
185 for (
size_t __i = __nbits; __i > 0; --__i)
187 const _CharT __c = __str[__pos + __nbits - __i];
188 if (_Traits::eq(__c, __zero))
190 else if (_Traits::eq(__c, __one))
204 template<
typename _CharT,
typename _Traits,
205 typename _WordT,
typename _Alloc>
210 typedef typename _Traits::char_type char_type;
212 typedef typename __istream_type::ios_base __ios_base;
217 const char_type __zero = __is.
widen(
'0');
218 const char_type __one = __is.
widen(
'1');
220 typename __ios_base::iostate __state = __ios_base::goodbit;
221 typename __istream_type::sentry __sentry(__is);
228 static typename _Traits::int_type __eof = _Traits::eof();
230 typename _Traits::int_type __c1 = __is.
rdbuf()->sbumpc();
231 if (_Traits::eq_int_type(__c1, __eof))
233 __state |= __ios_base::eofbit;
238 const char_type __c2 = _Traits::to_char_type(__c1);
239 if (_Traits::eq(__c2, __zero))
241 else if (_Traits::eq(__c2, __one))
244 eq_int_type(__is.
rdbuf()->sputbackc(__c2),
247 __state |= __ios_base::failbit;
267 __state |= __ios_base::failbit;
#define __throw_exception_again
#define _GLIBCXX_VISIBILITY(V)
#define _GLIBCXX_END_NAMESPACE_VERSION
#define _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr size_t __offset
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, dynamic_bitset< _WordT, _Alloc > &__x)
Stream input operator for dynamic_bitset.
void __throw_overflow_error(const char *)
void __throw_invalid_argument(const char *)
constexpr _OIter fill_n(_OIter, _Size, const _Tp &)
ISO C++ entities toplevel namespace is std.
void setstate(iostate __state)
Sets additional flags in the error state.
char_type widen(char __c) const
Widens characters.
void _M_setstate(iostate __state)
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
Template class basic_istream.
constexpr size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
constexpr void reserve(size_type __res_arg)
Attempt to preallocate enough memory for specified number of characters.
constexpr void push_back(_CharT __c)
Append a single character.
constexpr bool empty() const noexcept
Managing sequences of characters and character-like objects.
Thrown as part of forced unwinding.
static const size_type _S_bits_per_block
static size_type _S_whichword(size_type __pos) noexcept
unsigned long _M_do_to_ulong() const
void _M_do_right_shift(size_t __shift)
static size_type _S_whichbit(size_type __pos) noexcept
void _M_do_left_shift(size_t __shift)
std::vector< block_type, allocator_type > _M_w
0 is the least significant word.
unsigned long long _M_do_to_ullong() const
dynamic_bitset & reset()
Sets every bit to false.
void resize(size_type __nbits, bool __value=false)
Resize the bitset.
size_type size() const noexcept
Returns the total number of bits.
void _M_copy_from_ptr(const _CharT *, size_t, size_t, size_t, _CharT __zero=_CharT('0'), _CharT __one=_CharT('1'))
dynamic_bitset & _M_unchecked_set(size_type __pos) noexcept
void _M_copy_from_string(const basic_string< _CharT, _Traits, _Alloc1 > &__str, size_t __pos, size_t __n, _CharT __zero=_CharT('0'), _CharT __one=_CharT('1'))
The dynamic_bitset class represents a sequence of bits.