cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : STL Containers : bitset : size
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
STL Containers
bitset
deque
list
map
multimap
multiset
priority_queue
queue
set
stack
vector
bitset
bitset::bitset
bitset operators
member functions:
· bitset::any
· bitset::count
· bitset::flip
· bitset::none
· bitset::operator[]
· bitset::reset
· bitset::set
· bitset::size
· bitset::test
· bitset::to_string
· bitset::to_ulong

-

bitset::size public member function
size_t size() const;

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

// 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)

© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us