bitset - STL C++

bitset<N>::reset()

Declaration

bitset<N>& bitset<N>::reset();

Description

This is the member function reset() for the bitset class template. This function sets all of the bits in the bitset to 0. The overloaded version sets the bit at "qIndex" to 0.

Header Include

#include <bitset>

Overloads

bitset<N>& bitset<N>::reset(size_t qIndex);

Example

#include <bitset>
#include <iostream>

int main()
{
	using namespace std;

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

	// Reset all fo the bits to zero
	qBits.reset();
	cout << "bitset<4> : "<< qBits << endl;

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

Output

bitset<N>::reset() Output
 

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