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