bitset::any |
public member function |
Test if any bit is set
Returns whether any of the bits in the bitset is set.
Parameters
none
Return value
true if any of the bits in the
bitset is set, and
false otherwise.
Example
// bitset::any
#include <iostream>
#include <bitset>
using namespace std;
int main ()
{
bitset<16> mybits;
cout << "enter a binary number: ";
cin >> mybits;
if (mybits.any())
cout << "mybits has " << (int)mybits.count() << " bits set.\n";
else cout << "mybits has no bits set.\n";
return 0;
}
|
See also