bitset - STL C++

bitset<N>::none()

Declaration

bool bitset<N>::none() const;

Description

This is the member function none() for the bitset class template. This function returns true if none of the bits are equal to 1. Otherwise, the function returns false.

Header Include

#include <bitset>

Example

#include <bitset>
#include <iostream>

int main()
{
	using namespace std;

	// Create two bitsets
	bitset<4> qBits1(0);
	bitset<4> qBits2(12);
	cout << "bitset<4> #1 : "<< qBits1 << endl;
	cout << "bitset<4> #2 : "<< qBits2 << endl;

	// Call the none() function to test the bitsets.
	cout << (qBits1.none() ? "None" : "Some")
		<< " of the bits of bitset<4> #1 are 1." << endl;
	cout << (qBits2.none() ? "None" : "Some")
		<< " of the bits of bitset<4> #2 are 1." << endl;

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

Output

bitset<N>::none() Output
 

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