bitset - STL C++

bitset<N>::bitset()

Declaration

template <size_t N>
bitset<N>::bitset();

Description

This is the constructor for the bitset class template.

Header Include

#include <bitset>

Overloads

bitset(unsigned long long ullValue);

explicit bitset(const char* kcpString);

template<class XCharType, class XTraits, class XAllocator>
explicit bitset(const basic_string<XCharType, XTraits, XAllocator >& kqrStr,
                basic_string<XCharType, XTraits, XAllocator >::size_type qPos = 0);

template<class XCharType, class XTraits, class XAllocator>
explicit bitset(const basic_string<XCharType, XTraits, XAllocator >& kqrStr,
                basic_string<XCharType, XTraits, XAllocator >::size_type qPos,
                basic_string<XCharType, XTraits, XAllocator >::size_type qCount,
                XCharType xZero = XCharType('0'),
                XCharType xOne = XCharType('1'));

Example

#include <bitset>
#include <iostream>

int main( )
{
	using namespace std;

	// Create a bitset with the default constructor
	bitset<4> qDefaultBits;
	cout << "bitset<4>: "<< qDefaultBits << endl;

	// Create a bitset with the integer value constructor
	bitset<4> qValueBits(11);
	cout << "bitset<4>: "<< qValueBits << endl;

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

Output

bitset<N>::bitset() Output
 

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