public member function
<bitset>
Return size
Returns the number of bits in the bitset.
Parameters
none
Return Value
The number of bits in the bitset. This is the template parameter
N.
size_t is an unsigned integral type.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
// bitset::size
#include <iostream>
#include <bitset>
using namespace std;
int main ()
{
bitset<8> first;
bitset<4> second;
cout << "first.size() is " << (int) first.size() << endl;
cout << "second.size() is " << (int) second.size() << endl;
return 0;
}
|
Output:
first.size() is 8
second.size() is 4
|
See also
- bitset::count
- Count bits set (public member function)