libstdc++
std::tr2::dynamic_bitset< _WordT, _Alloc > Class Template Reference
Inheritance diagram for std::tr2::dynamic_bitset< _WordT, _Alloc >:
[legend]

Classes

class  reference
 

Public Types

typedef __dynamic_bitset_base< _WordT, _Alloc > _Base
 
typedef _Alloc allocator_type
 
typedef _WordT block_type
 
typedef bool const_reference
 
typedef size_t size_type
 

Public Member Functions

 dynamic_bitset (const allocator_type &__alloc=allocator_type())
 
 dynamic_bitset (size_type __nbits, unsigned long long __val=0ULL, const allocator_type &__alloc=allocator_type())
 
 dynamic_bitset (initializer_list< block_type > __il, const allocator_type &__alloc=allocator_type())
 
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 (const char *__str, const allocator_type &__alloc=allocator_type())
 
 dynamic_bitset (const dynamic_bitset &__b)
 
 dynamic_bitset (dynamic_bitset &&__b)
 
template<typename _CharT , typename _Traits >
void _M_copy_from_ptr (const _CharT *, size_t, size_t, size_t, _CharT, _CharT)
 
template<typename _CharT , typename _Traits , typename _Alloc1 >
void _M_copy_from_string (const std::basic_string< _CharT, _Traits, _Alloc1 > &__str, size_t __pos, size_t __n, _CharT __zero=_CharT('0'), _CharT __one=_CharT('1'))
 
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
 
bool any () const
 
void append (block_type __block)
 
void append (initializer_list< block_type > __il)
 
template<typename _BlockInputIterator >
void append (_BlockInputIterator __first, _BlockInputIterator __last)
 
void clear ()
 
size_type count () const noexcept
 
bool empty () const noexcept
 
size_type find_first () const
 
size_type find_next (size_t __prev) const
 
dynamic_bitset< _WordT, _Alloc > & flip ()
 
dynamic_bitset< _WordT, _Alloc > & flip (size_type __pos)
 
allocator_type get_allocator () const
 
bool is_proper_subset_of (const dynamic_bitset &__b) const
 
bool is_subset_of (const dynamic_bitset &__b) const
 
constexpr size_type max_size () noexcept
 
bool none () const
 
size_type num_blocks () const noexcept
 
dynamic_bitsetoperator= (const dynamic_bitset &__b)
 
dynamic_bitsetoperator= (dynamic_bitset &&__b)
 
dynamic_bitset< _WordT, _Alloc > operator~ () const
 
void push_back (bool __bit)
 
dynamic_bitset< _WordT, _Alloc > & reset ()
 
dynamic_bitset< _WordT, _Alloc > & reset (size_type __pos)
 
void resize (size_type __nbits, bool __value=false)
 
dynamic_bitset< _WordT, _Alloc > & set ()
 
dynamic_bitset< _WordT, _Alloc > & set (size_type __pos, bool __val=true)
 
size_type size () const noexcept
 
void swap (dynamic_bitset &__b)
 
bool test (size_type __pos) const
 
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
 
unsigned long to_ulong () const
 
dynamic_bitset< _WordT, _Alloc > & operator&= (const dynamic_bitset< _WordT, _Alloc > &__rhs)
 
dynamic_bitset< _WordT, _Alloc > & operator&= (dynamic_bitset< _WordT, _Alloc > &&__rhs)
 
dynamic_bitset< _WordT, _Alloc > & operator|= (const dynamic_bitset< _WordT, _Alloc > &__rhs)
 
dynamic_bitset< _WordT, _Alloc > & operator^= (const dynamic_bitset< _WordT, _Alloc > &__rhs)
 
dynamic_bitset< _WordT, _Alloc > & operator-= (const dynamic_bitset< _WordT, _Alloc > &__rhs)
 
dynamic_bitset< _WordT, _Alloc > & operator<<= (size_type __pos)
 
dynamic_bitset< _WordT, _Alloc > & operator>>= (size_type __pos)
 
reference operator[] (size_type __pos)
 
const_reference operator[] (size_type __pos) const
 
dynamic_bitset< _WordT, _Alloc > operator<< (size_type __pos) const
 
dynamic_bitset< _WordT, _Alloc > operator>> (size_type __pos) const
 

Static Public Attributes

static const size_type bits_per_block
 
static const size_type npos
 

Private Member Functions

size_t _M_are_all_aux () const
 
void _M_assign (const __dynamic_bitset_base &__b)
 
void _M_clear ()
 
void _M_do_and (const __dynamic_bitset_base &__x)
 
void _M_do_append_block (block_type __block, size_type __pos)
 
size_t _M_do_count () const
 
void _M_do_dif (const __dynamic_bitset_base &__x)
 
size_type _M_do_find_first (size_t __not_found) const
 
size_type _M_do_find_next (size_t __prev, size_t __not_found) const
 
void _M_do_flip ()
 
void _M_do_left_shift (size_t __shift)
 
void _M_do_or (const __dynamic_bitset_base &__x)
 
void _M_do_reset ()
 
void _M_do_right_shift (size_t __shift)
 
void _M_do_set ()
 
unsigned long long _M_do_to_ullong () const
 
unsigned long _M_do_to_ulong () const
 
void _M_do_xor (const __dynamic_bitset_base &__x)
 
allocator_type _M_get_allocator () const
 
block_type & _M_getword (size_type __pos)
 
block_type _M_getword (size_type __pos) const
 
block_type & _M_hiword ()
 
block_type _M_hiword () const
 
bool _M_is_any () const
 
bool _M_is_equal (const __dynamic_bitset_base &__x) const
 
bool _M_is_less (const __dynamic_bitset_base &__x) const
 
bool _M_is_proper_subset_of (const __dynamic_bitset_base &__b) const
 
bool _M_is_subset_of (const __dynamic_bitset_base &__b)
 
void _M_resize (size_t __nbits, bool __value)
 
size_type _M_size () const noexcept
 
void _M_swap (__dynamic_bitset_base &__b)
 

Static Private Member Functions

static block_type _S_maskbit (size_type __pos) noexcept
 
static size_type _S_whichbit (size_type __pos) noexcept
 
static size_type _S_whichbyte (size_type __pos) noexcept
 
static size_type _S_whichword (size_type __pos) noexcept
 

Private Attributes

std::vector< block_type, allocator_type > _M_w
 

Static Private Attributes

static const size_type _S_bits_per_block
 

Friends

bool operator< (const dynamic_bitset< _WordT, _Alloc > &__lhs, const dynamic_bitset< _WordT, _Alloc > &__rhs)
 
bool operator== (const dynamic_bitset< _WordT, _Alloc > &__lhs, const dynamic_bitset< _WordT, _Alloc > &__rhs)
 
class 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.

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.

1 #include <dynamic_bitset>
2 #include <iostream>
3 #include <sstream>
4 
5 using namespace std;
6 
7 int main()
8 {
9  long a = 'a';
10  dynamic_bitset<> b(a);
11 
12  cout << "b('a') is " << b << endl;
13 
14  ostringstream s;
15  s << b;
16  string str = s.str();
17  cout << "index 3 in the string is " << str[3] << " but\n"
18  << "index 3 in the bitset is " << b[3] << endl;
19 }

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.

Definition at line 413 of file dynamic_bitset.

Constructor & Destructor Documentation

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
std::tr2::dynamic_bitset< _WordT, _Alloc >::dynamic_bitset ( const allocator_type &  __alloc = allocator_type())
inlineexplicit

All bits set to zero.

Definition at line 574 of file dynamic_bitset.

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() 
)
inlineexplicit

Initial bits bitwise-copied from a single word (others set to zero).

Definition at line 580 of file dynamic_bitset.

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() 
)
inlineexplicit

Use a subset of a string.

Parameters
__strA string of '0' and '1' characters.
__posIndex of the first character in __str to use.
__nThe number of characters to copy.
__zeroThe character to use for unset bits.
__oneThe character to use for set bits.
__allocAn allocator.
Exceptions
std::out_of_rangeIf __pos is bigger the size of __str.
std::invalid_argumentIf a character appears in the string which is neither '0' nor '1'.

Definition at line 605 of file dynamic_bitset.

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() 
)
inlineexplicit

Construct from a string.

Parameters
__strA string of '0' and '1' characters.
__allocAn allocator.
Exceptions
std::invalid_argumentIf a character appears in the string which is neither '0' nor '1'.

Definition at line 634 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
std::tr2::dynamic_bitset< _WordT, _Alloc >::dynamic_bitset ( const dynamic_bitset< _WordT, _Alloc > &  __b)
inline

Copy constructor.

Definition at line 650 of file dynamic_bitset.

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

Move constructor.

Definition at line 657 of file dynamic_bitset.

Member Function Documentation

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.

Definition at line 1046 of file dynamic_bitset.

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.

Definition at line 1054 of file dynamic_bitset.

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.

Definition at line 740 of file dynamic_bitset.

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.

Definition at line 758 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
void std::tr2::dynamic_bitset< _WordT, _Alloc >::clear ( )
inline

Clear the bitset.

Definition at line 718 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
size_type std::tr2::dynamic_bitset< _WordT, _Alloc >::count ( ) const
inlinenoexcept

Returns the number of bits which are set.

Definition at line 1002 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
bool std::tr2::dynamic_bitset< _WordT, _Alloc >::empty ( ) const
inlinenoexcept

Returns true if the dynamic_bitset is empty.

Definition at line 1017 of file dynamic_bitset.

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

Definition at line 1082 of file dynamic_bitset.

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
__prevWhere to start searching.
See also
find_first

Definition at line 1092 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::flip ( )
inline

Toggles every bit to its opposite value.

Definition at line 897 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::flip ( size_type  __pos)
inline

Toggles a given bit to its opposite value.

Parameters
__posThe index of the bit.
Exceptions
std::out_of_rangeIf __pos is bigger the size of the set.

Definition at line 910 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
allocator_type std::tr2::dynamic_bitset< _WordT, _Alloc >::get_allocator ( ) const
inline

Return the allocator for the bitset.

Definition at line 698 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
constexpr size_type std::tr2::dynamic_bitset< _WordT, _Alloc >::max_size ( )
inlinenoexcept

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.

Definition at line 1024 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
bool std::tr2::dynamic_bitset< _WordT, _Alloc >::none ( ) const
inline

Tests whether any of the bits are on.

Returns
True if none of the bits are set.

Definition at line 1062 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
size_type std::tr2::dynamic_bitset< _WordT, _Alloc >::num_blocks ( ) const
inlinenoexcept

Returns the total number of blocks.

Definition at line 1012 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::operator&= ( const dynamic_bitset< _WordT, _Alloc > &  __rhs)
inline

Operations on dynamic_bitsets.

Parameters
__rhsA same-sized dynamic_bitset.

These should be self-explanatory.

Definition at line 773 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::operator&= ( dynamic_bitset< _WordT, _Alloc > &&  __rhs)
inline

Operations on dynamic_bitsets.

Parameters
__rhsA same-sized dynamic_bitset.

These should be self-explanatory.

Definition at line 780 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::operator-= ( const dynamic_bitset< _WordT, _Alloc > &  __rhs)
inline

Operations on dynamic_bitsets.

Parameters
__rhsA same-sized dynamic_bitset.

These should be self-explanatory.

Definition at line 801 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc> std::tr2::dynamic_bitset< _WordT, _Alloc >::operator<< ( size_type  __pos) const
inline

Self-explanatory.

Definition at line 1068 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::operator<<= ( size_type  __pos)
inline

Operations on dynamic_bitsets.

Parameters
__posThe number of places to shift.

These should be self-explanatory.

Definition at line 816 of file dynamic_bitset.

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 > &  __b)
inline

Assignment.

Definition at line 675 of file dynamic_bitset.

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

Move assignment.

Definition at line 688 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc> std::tr2::dynamic_bitset< _WordT, _Alloc >::operator>> ( size_type  __pos) const
inline

Self-explanatory.

Definition at line 1072 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::operator>>= ( size_type  __pos)
inline

Operations on dynamic_bitsets.

Parameters
__posThe number of places to shift.

These should be self-explanatory.

Definition at line 829 of file dynamic_bitset.

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
__posIndex 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.

Definition at line 932 of file dynamic_bitset.

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.

Parameters
__posIndex 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.

Definition at line 936 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::operator^= ( const dynamic_bitset< _WordT, _Alloc > &  __rhs)
inline

Operations on dynamic_bitsets.

Parameters
__rhsA same-sized dynamic_bitset.

These should be self-explanatory.

Definition at line 794 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::operator|= ( const dynamic_bitset< _WordT, _Alloc > &  __rhs)
inline

Operations on dynamic_bitsets.

Parameters
__rhsA same-sized dynamic_bitset.

These should be self-explanatory.

Definition at line 787 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc> std::tr2::dynamic_bitset< _WordT, _Alloc >::operator~ ( ) const
inline

See the no-argument flip().

Definition at line 919 of file dynamic_bitset.

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.

Definition at line 728 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::reset ( )
inline

Sets every bit to false.

Definition at line 872 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::reset ( size_type  __pos)
inline

Sets a given bit to false.

Parameters
__posThe index of the bit.
Exceptions
std::out_of_rangeIf __pos is bigger the size of the set.

Same as writing set(__pos, false).

Definition at line 886 of file dynamic_bitset.

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.

Definition at line 705 of file dynamic_bitset.

Referenced by std::tr2::operator>>().

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::set ( )
inline

Sets every bit to true.

Definition at line 847 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
dynamic_bitset<_WordT, _Alloc>& std::tr2::dynamic_bitset< _WordT, _Alloc >::set ( size_type  __pos,
bool  __val = true 
)
inline

Sets a given bit to a particular value.

Parameters
__posThe index of the bit.
__valEither true or false, defaults to true.
Exceptions
std::out_of_rangeIf __pos is bigger the size of the set.

Definition at line 861 of file dynamic_bitset.

template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>
size_type std::tr2::dynamic_bitset< _WordT, _Alloc >::size ( ) const
inlinenoexcept

Returns the total number of bits.

Definition at line 1007 of file dynamic_bitset.

Referenced by std::tr2::operator>>().

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

Swap with another bitset.

Definition at line 665 of file dynamic_bitset.

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
__posThe index of a bit.
Returns
The value at __pos.
Exceptions
std::out_of_rangeIf __pos is bigger the size of the set.

Definition at line 1034 of file dynamic_bitset.

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).

Definition at line 972 of file dynamic_bitset.

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_errorIf there are too many bits to be represented in an unsigned long.

Definition at line 957 of file dynamic_bitset.

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_errorIf there are too many bits to be represented in an unsigned long.

Definition at line 947 of file dynamic_bitset.


The documentation for this class was generated from the following files: