bitset::operator<<=
Visual Studio 2012
Shifts the bits in a bitset to the left a specified number of positions and returns the result to the targeted bitset.
bitset<N>& operator<<=( size_t _Pos );
// bitset_op_LSE.cpp
// compile with: /EHsc
#include <bitset>
#include <iostream>
int main( )
{
using namespace std;
bitset<5> b1 ( 7 );
cout << "The target bitset b1 is: ( "<< b1 << " )." << endl;
b1 <<= 2;
cout << "After shifting the bits 2 positions to the left,\n"
<< " the target bitset b1 becomes: ( "<< b1 << " )."
<< endl;
}
The target bitset b1 is: ( 00111 ). After shifting the bits 2 positions to the left, the target bitset b1 becomes: ( 11100 ).