bool all() const no except;
#include <iostream> #include <bitset> using namespace std; int main() { bitset<4> b; bitset<4> mask("1111"); if (!b.all()) cout<< "All bits are not set." <<endl; b |= mask; if (b.all()) cout<< "All bit are set." <<endl; return 0; }
All bits are not set. All bit are set.