The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.



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


The number of positions to the left the bits in the bitset are to be shifted.

The targeted bitset modified so that the bits have been shifted to the left the required number of positions.

If no element exists to shift into the position, the function clears the bit to a value of 0.


// 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 ).


Header: <bitset>

Namespace: std