A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/bitset/bitset/all/ below:

public member function

<bitset>

std::bitset::all
bool 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.



Parameters none

Return valuetrue if all of the bits in the bitset are set (to one), and false otherwise.

Example
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;
}

Possible output:
Please, enter an 8-bit binary number: 11111111
all: true
any: true
none: false


Data races The bitset is accessed.

Exception safetyNo-throw guarantee: never throws exceptions.

See also
bitset::count
Count bits set (public member function)
bitset::any
Test if any bit is set (public member function)
bitset::none
Test if no bit is set (public member function)
bitset::test
Return bit value (public member function)

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