bitset - STL C++

bitset<N>::element_type

Declaration

typedef bool bitset<N>::element_type;

Description

This is a type definition of the data type element_type for the bitset class template. This is used to define the type that is used to store the value of a bit in the bitset when it is taken outside of the bitset container.

Header Include

#include <bitset>

Example

#include <bitset>
#include <iostream>

int main()
{
	using namespace std;

	// Create a bitset
	bitset<4> qBits(5);
	cout << "bitset<4> : "<< qBits << endl;

	// Get the value at the index [2]
	bitset<4>::element_type qElement = qBits[2];
	cout << "The bit value at [2] is " << qElement << endl;

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

Output

bitset<N>::element_type Output
 

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