public member function
<bitset>
std::bitset::allbool all() const noexcept;
Test if all bits are set
Returns whether all of the bits in the bitset are set (to one).For this function to return true, all bits up to the bitset size shall be set.
true
if all of the bits in the bitset are set (to one), and false
otherwise.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// bitset::all
#include <iostream> // std::cin, std::cout, std::boolalpha
#include <bitset> // std::bitset
int main ()
{
std::bitset<8> foo;
std::cout << "Please, enter an 8-bit binary number: ";
std::cin >> foo;
std::cout << std::boolalpha;
std::cout << "all: " << foo.all() << '\n';
std::cout << "any: " << foo.any() << '\n';
std::cout << "none: " << foo.none() << '\n';
return 0;
}
Please, enter an 8-bit binary number: 11111111 all: true any: true none: false
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4