The bitset::all() is a built-in function in C++ STL which returns True if all bits are set in the binary representation of a number if it is initialized in the bitset. It returns False if all the bits are not set.
Parameter: This function does not accepts any parameter.
Return Value: The function returns a boolean value. The boolean value returned is true if all the bits are set, else the returned value is false,
Below programs illustrates the bitset::all() function.
1100 does not have all bits set 111111 has all bits set
11 has all bits set 101 does not have all bits set
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- bitset set() function in C++ STL
- std::bitset::to_ullong and std::bitset::to_ulong in C++ STL
- bitset reset() function in C++ STL
- _Find_next() function in C++ bitset with Examples
- _Find_first() function in C++ bitset with Examples
- bitset any() in C++ STL
- bitset none() in C++ STL
- bitset operator in C++ STL
- bitset count() in C++ STL
- bitset::flip() in C++ STL
- bitset size() in C++ STL
- C++ bitset and its application
- bitset test() in C++ STL
- C++ bitset interesting facts
- Subset sum queries using bitset
- Count number of set bits in a range using bitset
- Count number of common elements between two arrays by using Bitset and Bitwise operation
- Difference between user defined function and library function in C/C++
- Function Overloading vs Function Overriding in C++
- How to call some function before main() function in C++?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.