bitset::size() is a built-in STL in C++ which returns the total number of bits.
Parameter: The function accepts no parameter.
Return Value: The function returns an integral value which signifies the number of bits. It eventually returns the size that has been given while initializing the bitset.
Below programs illustrate the bitset::size() function.
The number of bits in 1100 is 4 The number of bits in 010010 is 6
The number of bits in 101 is 3 The number of bits in 10001 is 5
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 any() in C++ STL
- bitset test() in C++ STL
- bitset all() function in C++ STL
- bitset operator in C++ STL
- bitset set() function in C++ STL
- bitset::flip() in C++ STL
- bitset count() in C++ STL
- C++ bitset and its application
- C++ bitset interesting facts
- Subset sum queries using bitset
- bitset reset() function in C++ STL
- _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 : ManasChhabra2