STD::TR2::DYNAMIC_BITSET(3cxx)
๐
std::tr2::dynamic_bitset< _WordT, _Alloc > โ (3cxx) manual page ๐
โจ NAME โจ
okay bestie, welcome to the (3cxx) manual page for std::tr2::dynamic_bitset< _WordT, _Alloc > ๐ โ the dynamic_bitset class represents a sequence of bits. periodt.
๐ SYNOPSIS ๐
#include <dynamic_bitset>
Inherits std::tr2::__dynamic_bitset_base< _WordT, _Alloc >. no cap, that's the base-class situation ๐ซถ
๐ธ Classes ๐ธ
class reference
๐ Public Types ๐
typedef __dynamic_bitset_base< _WordT, _Alloc > _Basetypedef _Alloc allocator_typetypedef _WordT block_typetypedef bool const_referencetypedef size_t size_type
๐ Public Member Functions ๐
dynamic_bitset ()=defaultโ all bits set to zero โจdynamic_bitset (const allocator_type &__alloc)โ all bits set to zero โจdynamic_bitset (const char *__str, const allocator_type &__alloc=allocator_type())โ construct from a string ๐งdynamic_bitset (const dynamic_bitset &)=defaultโ copy constructor, iconic behavior ๐- the big string-subset constructor โ use a subset of a string:
template<typename _CharT , typename _Traits , typename _Alloc1 >
dynamic_bitset (const std::basic_string< _CharT, _Traits, _Alloc1 >
&__str, typename basic_string< _CharT, _Traits, _Alloc1 >::size_type
__pos=0, typename basic_string< _CharT, _Traits, _Alloc1
>::size_type __n=std::basic_string< _CharT, _Traits, _Alloc1
>::npos, _CharT __zero=_CharT('0'), _CharT __one=_CharT('1'), const
allocator_type &__alloc=allocator_type())
dynamic_bitset (dynamic_bitset &&__b) noexceptโ move constructor ๐ฆdynamic_bitset (initializer_list< block_type > __il, const allocator_type &__alloc=allocator_type())dynamic_bitset (size_type __nbits, unsigned long long __val=0ULL, const allocator_type &__alloc=allocator_type())โ initial bits bitwise-copied from a single word (others set to zero) ๐ฅ_M_copy_from_ptrโ exact signature:
template<typename _Traits = std::char_traits<char>, typename _CharT =
typename _Traits::char_type> void _M_copy_from_ptr (const _CharT *,
size_t, size_t, size_t, _CharT __zero=_CharT('0'), _CharT
__one=_CharT('1'))
_M_copy_from_stringโ exact signature:
template<typename _CharT , typename _Traits , typename _Alloc1 > 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'))
_M_copy_to_stringโ exact signature:
template<typename _CharT , typename _Traits , typename _Alloc1 > void
_M_copy_to_string (std::basic_string< _CharT, _Traits, _Alloc1 >
&__str, _CharT __zero=_CharT('0'), _CharT __one=_CharT('1')) const
bool all () constโ tests whether all the bits are on ๐bool any () constโ tests whether any of the bits are on ๐appendtime โ iterator-range version:
template<typename _BlockInputIterator > void append (_BlockInputIterator
__first, _BlockInputIterator __last)
appends an iterator range of blocks ๐
void append (block_type __block)โ appends a block ๐void append (initializer_list< block_type > __il)void clear ()โ clears the bitset ๐งนsize_type count () const noexceptโ returns the number of bits which are set ๐ขbool empty () const noexceptโ returns true if thedynamic_bitsetis empty ๐ซงsize_type find_first () constโ finds the index of the first 'on' bit ๐size_type find_next (size_t __prev) constโ finds the index of the next 'on' bit after prev ๐dynamic_bitset & flip ()โ toggles every bit to its opposite value ๐dynamic_bitset & flip (size_type __pos)โ toggles a given bit to its opposite value ๐allocator_type get_allocator () const noexceptโ return the allocator for the bitset ๐งบbool is_proper_subset_of (const dynamic_bitset &__b) constbool is_subset_of (const dynamic_bitset &__b) constconstexpr size_type max_size () noexceptโ returns the maximum size of adynamic_bitsetobject having the same type as*this. The real answer ismax() * bits_per_blockbut is likely to overflow ๐ญbool none () constโ tests whether any of the bits are on ๐size_type num_blocks () const noexceptโ returns the total number of blocks ๐งฑdynamic_bitset & operator= (const dynamic_bitset &)=defaultโ copy assignment operator ๐dynamic_bitset & operator= (dynamic_bitset &&__b) noexcept(std::is_nothrow_move_assignable< _Base >::value)โ move assignment operator ๐dynamic_bitset operator~ () constโ see the no-argumentflip()๐void push_back (bool __bit)โ push a bit onto the high end of the bitset ๐ซถdynamic_bitset & reset ()โ sets every bit to false ๐dynamic_bitset & reset (size_type __pos)โ sets a given bit to false ๐void resize (size_type __nbits, bool __value=false)โ resize the bitset ๐dynamic_bitset & set ()โ sets every bit to true โdynamic_bitset & set (size_type __pos, bool __val=true)โ sets a given bit to a particular value โsize_type size () const noexceptโ returns the total number of bits ๐ขvoid swap (dynamic_bitset &__b) noexceptโ swap with another bitset ๐bool test (size_type __pos) constโ tests the value of a bit ๐งชto_stringbestie โ returns a character interpretation of thedynamic_bitset:
template<typename _CharT = char, typename _Traits =
std::char_traits<_CharT>, typename _Alloc1 =
std::allocator<_CharT>> std::basic_string< _CharT, _Traits, _Alloc1
> to_string (_CharT __zero=_CharT('0'), _CharT __one=_CharT('1'))
const
unsigned long long to_ullong () constโ returns a numerical interpretation of thedynamic_bitset๐ขunsigned long to_ulong () constโ returns a numerical interpretation of thedynamic_bitset๐ข
and now, the operator-y besties ๐ :
dynamic_bitset & operator&= (const dynamic_bitset &__rhs)โ operations on dynamic_bitsets ๐งฎdynamic_bitset & operator&= (dynamic_bitset &&__rhs)โ operations on dynamic_bitsets ๐งฎdynamic_bitset & operator|= (const dynamic_bitset &__rhs)โ operations on dynamic_bitsets ๐งฎdynamic_bitset & operator^= (const dynamic_bitset &__rhs)โ operations on dynamic_bitsets ๐งฎdynamic_bitset & operator-= (const dynamic_bitset &__rhs)โ operations on dynamic_bitsets ๐งฎdynamic_bitset & operator<<= (size_type __pos)โ operations on dynamic_bitsets ๐งฎdynamic_bitset & operator>>= (size_type __pos)โ operations on dynamic_bitsets ๐งฎreference operator[] (size_type __pos)โ array-indexing support ๐ขconst_reference operator[] (size_type __pos) constโ array-indexing support ๐ขdynamic_bitset operator<< (size_type __pos) constโ self-explanatory ๐dynamic_bitset operator>> (size_type __pos) constโ self-explanatory ๐
๐ Static Public Attributes ๐
static const size_type bits_per_blockstatic const size_type npos
๐ซถ Friends ๐ซถ
bool operator< (const dynamic_bitset &__lhs, const dynamic_bitset &__rhs) noexceptbool operator== (const dynamic_bitset &__lhs, const dynamic_bitset &__rhs) noexceptclass reference
๐ Detailed Description ๐
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>>
class std::tr2::dynamic_bitset< _WordT, _Alloc >"The dynamic_bitset
class represents a sequence of bits.
See N2050, Proposal to Add a Dynamically Sizeable Bitset to the Standard Library. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2050.pdf ๐โจ
In the general unoptimized case, storage is allocated in word-sized blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B words will be used for storage. B - NbB bits are unused. (They are the high-order bits in the highest word.) It is a class invariant that those unused bits are always zero. ๐
If you think of dynamic_bitset as 'a simple array of bits,' be aware that your mental picture is reversed: a dynamic_bitset behaves the same way as bits in integers do, with the bit at index 0 in the 'least significant / right-hand' position, and the bit at index Nb-1 in the 'most significant / left-hand' position. Thus, unlike other containers, a dynamic_bitset's index 'counts from right to left,' to put it very loosely. ๐ช
This behavior is preserved when translating to and from strings. For example, the first line of the following program probably prints 'b('a') is 0001100001' on a modern ASCII system. ๐งช
#include <dynamic_bitset>
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
long a = 'a';
dynamic_bitset<> b(a);
cout << "b('a') is " << b << endl;
ostringstream s;
s << b;
string str = s.str();
cout << "index 3 in the string is " << str[3] << " but\n"
<< "index 3 in the bitset is " << b[3] << endl;
}
Most of the actual code isn't contained in dynamic_bitset<> itself, but in the base class __dynamic_bitset_base. The base class works with whole words, not with individual bits. This allows us to specialize __dynamic_bitset_base for the important special case where the dynamic_bitset is only a single word. ๐ง
Extra confusion can result due to the fact that the storage for __dynamic_bitset_base is a vector, and is indexed as such. This is carefully encapsulated. ๐
โจ Constructor & Destructor Documentation โจ
okay so this is the constructor zone ๐ ๏ธโจ same template prefix every time, and Iโm keeping every default arg and attribute exactly because the facts do not move. ๐
๐งธ dynamic_bitset() โ default constructor
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> std::tr2::dynamic_bitset< _WordT, _Alloc
>::dynamic_bitset () [default]
All bits set to zero. ๐ซถ
Referenced by std::tr2::dynamic_bitset< _WordT, _Alloc >::operator<<(), and std::tr2::dynamic_bitset< _WordT, _Alloc >::operator>>().
๐ dynamic_bitset(const allocator_type &__alloc) โ allocator constructor
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> std::tr2::dynamic_bitset< _WordT, _Alloc
>::dynamic_bitset (const allocator_type & __alloc) [inline], [explicit]
All bits set to zero. โจ
๐ฆ dynamic_bitset(size_type __nbits, unsigned long long __val = 0ULL, const allocator_type &__alloc = allocator_type())
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> std::tr2::dynamic_bitset< _WordT, _Alloc
>::dynamic_bitset (size_type __nbits, unsigned long long __val = 0ULL,
const allocator_type & __alloc = allocator_type()) [inline], [explicit]
Initial bits bitwise-copied from a single word (others set to zero). ๐ฅ
๐ธ dynamic_bitset(const std::basic_string<...>& __str, ...) โ subset-of-string constructor
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> template<typename _CharT , typename _Traits ,
typename _Alloc1 > std::tr2::dynamic_bitset< _WordT, _Alloc
>::dynamic_bitset (const std::basic_string< _CharT, _Traits, _Alloc1 > &
__str, typename basic_string< _CharT, _Traits, _Alloc1 >::size_type
__pos = 0, typename basic_string< _CharT, _Traits, _Alloc1 >::size_type
__n = std::basic_string<_CharT, _Traits, _Alloc1>::npos, _CharT __zero =
_CharT('0'), _CharT __one = _CharT('1'), const allocator_type & __alloc
= allocator_type()) [inline], [explicit]
Use a subset of a string. โจ
Parameters
__strโ A string of '0' and '1' characters.__posโ Index of the first character in__strto use.__nโ The number of characters to copy.__zeroโ The character to use for unset bits.__oneโ The character to use for set bits.__allocโ An allocator.
Exceptions
std::out_of_rangeโ If__posis bigger the size of__str.std::invalid_argumentโ If a character appears in the string which is neither '0' nor '1'.
References std::tr2::dynamic_bitset< _WordT, _Alloc >::resize(), and std::basic_string< _CharT, _Traits, _Alloc >::size().
๐ dynamic_bitset(const char *__str, const allocator_type &__alloc = allocator_type())
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> std::tr2::dynamic_bitset< _WordT, _Alloc
>::dynamic_bitset (const char * __str, const allocator_type & __alloc =
allocator_type()) [inline], [explicit]
Construct from a string. ๐
Parameters
__strโ A string of '0' and '1' characters.__allocโ An allocator.
Exceptions
std::invalid_argumentโ If a character appears in the string which is neither '0' nor '1'.
๐ง dynamic_bitset(const dynamic_bitset<_WordT, _Alloc>&) โ copy constructor
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> std::tr2::dynamic_bitset< _WordT, _Alloc
>::dynamic_bitset (const dynamic_bitset< _WordT, _Alloc > &) [default]
Copy constructor. ๐ซถ
๐ dynamic_bitset(dynamic_bitset<_WordT, _Alloc>&& __b) โ move constructor
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> std::tr2::dynamic_bitset< _WordT, _Alloc
>::dynamic_bitset (dynamic_bitset< _WordT, _Alloc > && __b) [inline],
[noexcept]
Move constructor. ๐ญ๐ฅ
โจ Member Function Documentation โจ
๐ all() const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> bool std::tr2::dynamic_bitset< _WordT, _Alloc
>::all () const [inline]
Tests whether all the bits are on. ๐
Returns True if all the bits are set.
๐ any() const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> bool std::tr2::dynamic_bitset< _WordT, _Alloc
>::any () const [inline]
Tests whether any of the bits are on. ๐
Returns True if at least one bit is set.
๐ฆ append(_BlockInputIterator __first, _BlockInputIterator __last)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> template<typename _BlockInputIterator > void
std::tr2::dynamic_bitset< _WordT, _Alloc >::append (_BlockInputIterator
__first, _BlockInputIterator __last) [inline]
Append an iterator range of blocks. โจ
References std::tr2::dynamic_bitset< _WordT, _Alloc >::append().
๐ append(block_type __block)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> void std::tr2::dynamic_bitset< _WordT, _Alloc
>::append (block_type __block) [inline]
Append a block. ๐
Referenced by std::tr2::dynamic_bitset< _WordT, _Alloc >::append().
๐งน clear()
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> void std::tr2::dynamic_bitset< _WordT, _Alloc
>::clear () [inline]
Clear the bitset. ๐งน
๐ข count() const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> size_type std::tr2::dynamic_bitset< _WordT,
_Alloc >::count () const [inline], [noexcept]
Returns the number of bits which are set. ๐ข
๐ซง empty() const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> bool std::tr2::dynamic_bitset< _WordT, _Alloc
>::empty () const [inline], [noexcept]
Returns true if the dynamic_bitset is empty. ๐ซง
๐ find_first() const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> size_type std::tr2::dynamic_bitset< _WordT,
_Alloc >::find_first () const [inline]
Finds the index of the first 'on' bit. ๐
Returns The index of the first bit set, or size() if not found.
See also find_next
๐ find_next(size_t __prev) const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> size_type std::tr2::dynamic_bitset< _WordT,
_Alloc >::find_next (size_t __prev) const [inline]
Finds the index of the next 'on' bit after prev. ๐
Returns The index of the next bit set, or size() if not found.
Parameters
__prevโ Where to start searching.
See also find_first
๐ flip()
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::flip () [inline]
Toggles every bit to its opposite value. ๐
Referenced by std::tr2::dynamic_bitset< _WordT, _Alloc >::operator~().
๐ flip(size_type __pos)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::flip (size_type __pos) [inline]
Toggles a given bit to its opposite value. ๐
Parameters
__posโ The index of the bit.
Exceptions
std::out_of_rangeโ If__posis bigger the size of the set.
๐ get_allocator() const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> allocator_type std::tr2::dynamic_bitset< _WordT,
_Alloc >::get_allocator () const [inline], [noexcept]
Return the allocator for the bitset. ๐
Referenced by std::tr2::dynamic_bitset< _WordT, _Alloc >::operator=().
๐ max_size()
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> constexpr size_type std::tr2::dynamic_bitset<
_WordT, _Alloc >::max_size () [inline], [constexpr], [noexcept]
Returns the maximum size of a dynamic_bitset object having the same type as *this. The real answer is max() * bits_per_block but is likely to overflow. ๐ญ
References std::numeric_limits< _Tp >::max().
๐ซ none() const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> bool std::tr2::dynamic_bitset< _WordT, _Alloc
>::none () const [inline]
The docs literally say โTests whether any of the bits are on.โ for none() ๐ญ (thatโs the original wording, bestie).
Returns True if none of the bits are set.
๐งฑ num_blocks() const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> size_type std::tr2::dynamic_bitset< _WordT,
_Alloc >::num_blocks () const [inline], [noexcept]
Returns the total number of blocks. ๐งฑ
๐งท operator&=(const dynamic_bitset<_WordT, _Alloc>& __rhs)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator&= (const dynamic_bitset< _WordT, _Alloc > &
__rhs) [inline]
Operations on dynamic_bitsets. ๐งท
Parameters
__rhsโ A same-sized dynamic_bitset.
These should be self-explanatory. ๐
๐งท operator&=(dynamic_bitset<_WordT, _Alloc>&& __rhs)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator&= (dynamic_bitset< _WordT, _Alloc > && __rhs)
[inline]
Operations on dynamic_bitsets. ๐งท
Parameters
__rhsโ A same-sized dynamic_bitset.
These should be self-explanatory. ๐
References std::move().
โ operator-=(const dynamic_bitset<_WordT, _Alloc>& __rhs)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator-= (const dynamic_bitset< _WordT, _Alloc > &
__rhs) [inline]
Operations on dynamic_bitsets. โ
Parameters
__rhsโ A same-sized dynamic_bitset.
These should be self-explanatory. ๐
โฌ
๏ธ operator<<(size_type __pos) const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset std::tr2::dynamic_bitset< _WordT,
_Alloc >::operator<< (size_type __pos) const [inline]
Self-explanatory. ๐ซถ
References std::tr2::dynamic_bitset< _WordT, _Alloc >::dynamic_bitset().
โฌ
๏ธ operator<<=(size_type __pos)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator<<= (size_type __pos) [inline]
Operations on dynamic_bitsets. โฌ ๏ธ
Parameters
__posโ The number of places to shift.
These should be self-explanatory. ๐
๐ operator=(const dynamic_bitset<_WordT, _Alloc>&)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator= (const dynamic_bitset< _WordT, _Alloc > &)
[default]
Copy assignment operator. ๐
๐ operator=(dynamic_bitset<_WordT, _Alloc>&& __b)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator= (dynamic_bitset< _WordT, _Alloc > && __b)
[inline], [noexcept]
Move assignment operator. ๐
References std::tr2::dynamic_bitset< _WordT, _Alloc >::get_allocator().
โก๏ธ operator>>(size_type __pos) const
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset std::tr2::dynamic_bitset< _WordT,
_Alloc >::operator>> (size_type __pos) const [inline]
Self-explanatory. ๐ซถ
References std::tr2::dynamic_bitset< _WordT, _Alloc >::dynamic_bitset().
โก๏ธ operator>>=(size_type __pos)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator>>= (size_type __pos) [inline]
Operations on dynamic_bitsets. โก๏ธ
Parameters
__posโ The number of places to shift.
These should be self-explanatory. ๐
๐ฏ operator[](size_type __pos)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> reference std::tr2::dynamic_bitset< _WordT,
_Alloc >::operator[] (size_type __pos) [inline]
Array-indexing support. ๐ฏ
Parameters
__posโ Index into the dynamic_bitset.
Returns A bool for a 'const dynamic_bitset'. For non-const bitsets, an instance of the reference proxy class.
โ ๏ธ Note These operators do no range checking and throw no exceptions, as required by DR 11 to the standard.
๐
operator[] (const one) โ array-indexing support, periodt
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> const_reference std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator[] (size_type __pos) const [inline]
Array-indexing support, bestie โ this is the const flavor of indexing into the bitset.
Parameters
__posโ index into thedynamic_bitset.
Returns
A bool for a 'const dynamic_bitset'. For non-const bitsets, an instance of the reference proxy class.
Note ๐จ These operators do no range checking and throw no exceptions, as required by DR 11 to the standard. No cap, that's literally the rule.
๐ฅ operator^=
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator^= (const dynamic_bitset< _WordT, _Alloc > &
__rhs) [inline]
Operations on dynamic_bitsets โ yes, this is one of them. ๐
Parameters
__rhsโ a same-sizeddynamic_bitset.
These should be self-explanatory (fr fr).
โจ operator|=
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::operator|= (const dynamic_bitset< _WordT, _Alloc > &
__rhs) [inline]
Operations on dynamic_bitsets โ same iconic energy, different operator. ๐
Parameters
__rhsโ a same-sizeddynamic_bitset.
These should be self-explanatory (no notes needed, bestie).
๐ฆ operator~
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset std::tr2::dynamic_bitset< _WordT,
_Alloc >::operator~ () const [inline]
See the no-argument flip(). That's the whole vibe.
References
std::tr2::dynamic_bitset< _WordT, _Alloc >::flip()
๐ push_back
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> void std::tr2::dynamic_bitset< _WordT, _Alloc
>::push_back (bool __bit) [inline]
Push a bit onto the high end of the bitset. ๐ซถ
References
std::tr2::dynamic_bitset< _WordT, _Alloc >::size()
๐ธ reset()
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::reset () [inline]
Sets every bit to false. Clean slate, zero drama. ๐
๐ reset(size_type __pos)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::reset (size_type __pos) [inline]
Sets a given bit to false.
Parameters
__posโ the index of the bit.
Exceptions
std::out_of_rangeโ if__posis bigger the size of the set.
Same as writing set(__pos, false).
๐ง resize
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> void std::tr2::dynamic_bitset< _WordT, _Alloc
>::resize (size_type __nbits, bool __value = false) [inline]
Resize the bitset.
Referenced by
std::tr2::dynamic_bitset< _WordT, _Alloc >::dynamic_bitset(), and std::tr2::operator>>().
๐ set()
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::set () [inline]
Sets every bit to true. Main character energy only. ๐
โญ set(size_type __pos, bool __val = true)
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> dynamic_bitset & std::tr2::dynamic_bitset<
_WordT, _Alloc >::set (size_type __pos, bool __val = true) [inline]
Sets a given bit to a particular value.
Parameters
__posโ the index of the bit.__valโ either true or false, defaults to true.
Exceptions
std::out_of_rangeโ if__posis bigger the size of the set.
๐ size
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> size_type std::tr2::dynamic_bitset< _WordT,
_Alloc >::size () const [inline], [noexcept]
Returns the total number of bits.
Referenced by
std::tr2::operator>>(), and std::tr2::dynamic_bitset< _WordT, _Alloc >::push_back().
๐ซถ swap
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> void std::tr2::dynamic_bitset< _WordT, _Alloc
>::swap (dynamic_bitset< _WordT, _Alloc > & __b) [inline], [noexcept]
Swap with another bitset. Tradesies, but make it efficient. โจ
๐ฅ test
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> bool std::tr2::dynamic_bitset< _WordT, _Alloc
>::test (size_type __pos) const [inline]
Tests the value of a bit.
Parameters
__posโ the index of a bit.
Returns
The value at __pos.
Exceptions
std::out_of_rangeโ if__posis bigger the size of the set.
๐ to_string
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> template<typename _CharT = char, typename
_Traits = std::char_traits<_CharT>, typename _Alloc1 =
std::allocator<_CharT>> std::basic_string< _CharT, _Traits, _Alloc1 >
std::tr2::dynamic_bitset< _WordT, _Alloc >::to_string (_CharT __zero =
_CharT('0'), _CharT __one = _CharT('1')) const [inline]
Returns a character interpretation of the dynamic_bitset.
Returns
The string equivalent of the bits.
Note ๐ the ordering of the bits: decreasing character positions correspond to increasing bit positions (see the main class notes for an example). It's giving fancy, but it's consistent, okay?
๐ฆ to_ullong
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> unsigned long long std::tr2::dynamic_bitset<
_WordT, _Alloc >::to_ullong () const [inline]
Returns a numerical interpretation of the dynamic_bitset.
Returns
The integral equivalent of the bits.
Exceptions
std::overflow_errorโ if there are too many bits to be represented in an unsigned long.
๐ง to_ulong
template<typename _WordT = unsigned long long, typename _Alloc =
std::allocator<_WordT>> unsigned long std::tr2::dynamic_bitset< _WordT,
_Alloc >::to_ulong () const [inline]
Returns a numerical interpretation of the dynamic_bitset.
Returns
The integral equivalent of the bits.
Exceptions
std::overflow_errorโ if there are too many bits to be represented in an unsigned long.
๐ Author
Generated automatically by Doxygen for libstdc++ from the source code.
That's the footer tea, bestie: source/version is the libstdc++ (3cxx) page situation, and the date is exactly whatever that footer printed โ not me copying the line, just giving you the cute sign-off. Byeeee ๐โจ๐
๐ฆ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms