bitset::test() is an inbuilt function in C++ STL which tests whether the bit at a given index is set or not.
Parameters: The function accepts only a single mandatory parameter index which specifies the index at which the bit is set or not.
Return Value: The function returns a boolean value. It returns true if the bit at the given index is set else it returns false.
Below programs illustrate the above function:
Bit at index 2 of 1100 is set Bit at index 3 of 010010 is not set
Bit at index 2 of 5 is set Bit at index 3 of 16 is not set
- std::bitset::to_ullong and std::bitset::to_ulong in C++ STL
- bitset any() in C++ STL
- bitset none() in C++ STL
- bitset operator in C++ STL
- bitset set() function in C++ STL
- bitset count() in C++ STL
- bitset::flip() in C++ STL
- C++ bitset and its application
- bitset all() function in C++ STL
- bitset size() in C++ STL
- bitset reset() function 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
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.