Standard C++ Library Reference ISO/IEC (VERSION3)
reference& flip();
};
The member class describes an object that designates an individual bit within the bit sequence.
Thus, for val an object of type bool, bs and bs2 objects of type bitset<Bits>, and I and
J valid positions within such an object, the member functions of class reference ensure that
(in order):
bs[I] = val stores val at bit position I in bs●
bs[I] = bs2[J] stores the value of the bit bs2[J] at bit position I in bs●
val = ~bs[I] stores the flipped value of the bit bs[I] in val●
val = bs[I] stores the value of the bit bs[I] in val●
bs[I].flip() stores the flipped value of the bit bs[I] back at bit position I in bs●
bitset::reset
bitset<Bits>& reset();
bitset<Bits>& reset(size_t pos);
The first member function resets (or clears) all bits in the bit sequence, then returns *this. The
second member function throws out_of_range if size() <= pos. Otherwise, it resets the
bit at position pos, then returns *this.
bitset::set
bitset<Bits>& set();
bitset<Bits>& set(size_t pos, bool val = true);
The first member function sets all bits in the bit sequence, then returns *this. The second
member function throws out_of_range if size() <= pos. Otherwise, it stores val in the
bit at position pos, then returns *this.
bitset::size
size_t size() const;
The member function returns Bits.
bitset::test
bool test(size_t pos);
The member function throws out_of_range if size() <= pos. Otherwise, it returns true
only if the bit at position pos is set.