GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::bitset::all,std::bitset::any,std::bitset::none(3) C++ Standard Libary std::bitset::all,std::bitset::any,std::bitset::none(3)

std::bitset::all,std::bitset::any,std::bitset::none - std::bitset::all,std::bitset::any,std::bitset::none


bool all() const noexcept; (until C++23)
constexpr bool all() const (since C++23)
noexcept;
bool any() const; (until C++11)
bool any() const noexcept; (since C++11)
(until C++23)
constexpr bool any() const (1) (since C++23)
noexcept; (2)
bool none() const; (until C++11)
bool none() const noexcept; (since C++11)
(3) (until C++23)
constexpr bool none() const (since C++23)
noexcept;


Checks if all, any or none of the bits are set to true.


1) Checks if all bits are set to true
2) Checks if any bits are set to true
3) Checks if none of the bits are set to true


(none)


1) true if all bits are set to true, otherwise false
2) true if any of the bits are set to true, otherwise false
3) true if none of the bits are set to true, otherwise false

// Run this code


#include <iostream>
#include <bitset>


int main()
{
std::bitset<4> b1("0000");
std::bitset<4> b2("0101");
std::bitset<4> b3("1111");


std::cout
<< "bitset\t" << "all\t" << "any\t" << "none\n"
<< b1 << '\t' << b1.all() << '\t' << b1.any() << '\t' << b1.none() << '\n'
<< b2 << '\t' << b2.all() << '\t' << b2.any() << '\t' << b2.none() << '\n'
<< b3 << '\t' << b3.all() << '\t' << b3.any() << '\t' << b3.none() << '\n';
}


bitset all any none
0000 0 0 1
0101 0 1 0
1111 1 1 0


count returns the number of bits set to true
(public member function)
popcount counts the number of 1 bits in an unsigned integer
(C++20) (function template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.