Standard C++ Library Reference ISO/IEC (VERSION3)

bitset::bitset
bitset();
bitset(unsigned long val);
template<class Elem, class Tr, class Alloc>
explicit bitset(const basic_string<Elem, Tr, Alloc>& str,
typename basic_string<Elem, Tr, Alloc>::size_type
pos = 0,
typename basic_string<Elem, Tr, Alloc>::size_type
count = basic_string<Elem, Tr, Alloc>::npos);
The first constructor resets all bits in the bit sequence. The second constructor sets only those
bits at position J for which val & 1 << J is nonzero.
The third constructor determines the initial bit values from elements of a string determined from
str. If str.size() < pos, the constructor throws an object of class out_of_range.
Otherwise, the effective length of the string rlen is the smaller of count and str.size()
- pos. If any of the rlen elements beginning at position pos is other than 0 or 1, the
constructor throws an object of class invalid_argument. Otherwise, the constructor sets
only those bits at position J for which the element at position pos + J is 1.
bitset::count
size_t count() const;
The member function returns the number of bits set in the bit sequence.
bitset::element_type
typedef bool element_type;
The type is a synonym for bool.
bitset::flip
bitset<Bits>& flip();
bitset<Bits>& flip(size_t pos);
The first member function flips all bits in the bit sequence, then returns *this. The second
member function throws out_of_range if size() <= pos. Otherwise, it flips the bit at
position pos, then returns *this.
bitset::none
bool none() const;
The member function returns true if none of the bits are set in the bit sequence.