bitset - STL C++

bitset<N>:::operator<<()

Declaration

bitset<N> bitset<N>::operator<<(size_t qPos) const;

Description

This is the member function operator<<() for the bitset class template. This function returns a left bit-shifted version of the bitset that is shifted left by "qPos" bits.

Header Include

#include <bitset>

Example

#include <bitset>
#include <iostream>

int main()
{
	using namespace std;

	// Create a bitset
	bitset<8> qBits(75);
	cout << "bitset<8> : "<< qBits << endl;

	// Shift the bits in the bitset
	bitset<8> qShiftedBits = (qBits << 2);
	cout << "Shifted : "<< qShiftedBits << endl;

	// Keep the window open
	cin.get();
	return 0;
}

Output

bitset<N>::operator<<() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.