Cpp-standard-library-cpp-bitset-operator-left-shift-self
提供:Dev Guides
C ++ビットセットライブラリ-operator << =関数
説明
- C ++関数 *std
- bitset :: operator << =* は、現在のビットセットオブジェクトに対してビット単位の左シフト操作を実行します。
宣言
- 次に、std
- bitset :: operator << =関数形式のstd :: bitsetヘッダーの宣言を示します。
C 98
bitset& operator<<= (size_t pos);
C 11
bitset& operator<<= (size_t pos) noexcept;
パラメーター
*pos* -シフトするビット数。
戻り値
`+ this +`ポインタを返します。
例外
このメンバー関数は例外をスローしません。
例
- 次の例は、std
- bitset :: operator << =関数の使用法を示しています。
#include <iostream>
#include <bitset>
using namespace std;
int main(void) {
bitset<4> b("0001");
b <<= 1;
cout << b << endl;
return 0;
}
上記のプログラムをコンパイルして実行すると、次の結果が生成されます-
0010