bitset::reset

重置在bitset的所有位设置为0或重置位在指定的位置为0。

bitset<N>& reset( ); 
bitset<N>& reset(
   size_t _Pos
);

参数

  • _Pos
    位的位置在将重置的bitset为0。

返回值

成员函数调用bitset的副本。

备注

第二个成员函数引发异常 out_of_range,如果指定的该位置高于bitset的大小大于。

示例

// bitset_reset.cpp
// compile with: /EHsc
#include <bitset>
#include <iostream>

int main( )
{
   using namespace std;

   bitset<5> b1 ( 13 );
   cout << "The set of bits in bitset<5> b1(13) is: ( "<< b1 << " )"
        << endl;

   bitset<5> b1r3;
   b1r3 = b1.reset( 2 );
   cout << "The collecion of bits obtained from resetting the\n"
        << " third bit of bitset b1 is: ( "<< b1r3 << " )" 
        << endl;

   bitset<5> b1r;
   b1r = b1.reset( );
   cout << "The collecion of bits obtained from resetting all\n"
        << " the elements of the bitset b1 is: ( "<< b1r << " )"
        << endl;
}
  

要求

标头: <bitset>

命名空间: std

请参见

参考

bitset Class