The bitset::any() is an inbuilt function in C++ STL which returns True if at least one bit is set in a number. It returns False if all the bits are not set or if the number is zero.
Parameter: The function does not accepts any parameter.
Return Value: The function returns a boolean value. The boolean value thus returned is True if any of its bits are set. It is False if none of its bits are set.
Below programs illustrates the bitset::any() function.
1100 has a minimum of one-bit set 000000 does not have any bits set
11 has a minimum of one-bit set 000 does not have any bit set
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- std::bitset::to_ullong and std::bitset::to_ulong in C++ STL
- bitset none() in C++ STL
- bitset all() function in C++ STL
- bitset count() in C++ STL
- bitset test() in C++ STL
- bitset set() function in C++ STL
- bitset operator in C++ STL
- C++ bitset and its application
- bitset::flip() in C++ STL
- bitset size() in C++ STL
- bitset reset() function in C++ STL
- C++ bitset interesting facts
- Subset sum queries using bitset
- _Find_first() function in C++ bitset with Examples
- _Find_next() function in C++ bitset with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.
Improved By : gjaiswal108