共用方式為


bitset::operator>>=

在 bitset 移位的位元向右每個位置指定數目的並傳回結果給目標 bitset。

bitset<N>& operator>>=(
   size_t _Pos
);

參數

  • _Pos
    格式化字串中可編輯的右邊位元在 bitset 要移位。

傳回值

修改過的目標 bitset,以便位元移位右側位置的必要數目。

備註

如果項目存在切換至位置,函式清除位元值為 0。

範例

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

int main( )
{
   using namespace std;
   bitset<5> b1 ( 28 );
   cout << "The target bitset b1 is: ( "<< b1 << " )." << endl;

   b1 >>= 2;
   cout << "After shifting the bits 2 positions to the right,\n"
        << " the target bitset b1 becomes: ( "<< b1 << " )." 
        << endl;
}
  

需求

標題: <bitset>

命名空間: std

請參閱

參考

bitset 類別