bitset::flip

bitset<N>& flip();
bitset<N>& 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.