public member function

std::bitset::reset

<bitset>
bitset<N>& reset ( );
bitset<N>& reset ( size_t pos );
Reset bits
The version with no parameters resets all the bits in the bitset (sets all bits to 0).
The parameterized version, resets (sets to 0) the bit at position pos.

Parameters

pos
Order position of the bit whose value is modified.
Order positions are counted from the rightmost bit, which is order position 0.
size_t is an unsigned integral type.

Return value

*this
If pos is not a valid bit position, out_of_range is thrown.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// bitset::reset
#include <iostream>
#include <string>
#include <bitset>
using namespace std;

int main ()
{
  bitset<4> mybits (string("1011"));

  cout << mybits.reset(1) << endl;    // 1001
  cout << mybits.reset() << endl;    // 0000

  return 0;
}


See also