Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Tests if no bit has been set to 1 in a bitset object.
bool none( ) const;
Return Value
true if no bit in the bitset has been set to 1; false if at least one bit has been set to 1.
Example
// bitset_none.cpp
// compile with: /EHsc
#include <bitset>
#include <iostream>
int main( )
{
using namespace std;
bitset<5> b1 ( 6 );
bool b, rb;
cout << "Original bitset b1(6) is: ( " << b1 << " )"
<< endl;
b = b1.none ( );
if ( b )
cout << "None of the bits in bitset b1 are set to 1."
<< endl;
else
cout << "At least one of the bits in bitset b1 is set to 1."
<< endl;
bitset<5> rb1;
rb1 = b1.reset ( );
rb = rb1.none ( );
if ( rb )
cout << "None of the bits in bitset b1 are set to 1."
<< endl;
else
cout << "At least one of the bits in bitset b1 is set to 1."
<< endl;
}
Original bitset b1(6) is: ( 00110 ) At least one of the bits in bitset b1 is set to 1. None of the bits in bitset b1 are set to 1.
Requirements
Header: <bitset>
Namespace: std