bitset Class
Describes a type of object that stores a sequence consisting of a fixed number of bits that provide a compact way of keeping flags for a set of items or conditions. The bitset class supports operations on objects of type bitset that contain a collection of bits and provide constant-time access to each bit.
For a list of all members of this type, see bitset Members.
template <size_t N>
class bitset
Parameters
- N
Specifies the number of bits in the bitset object with a nonzero integer of type size_t that must be known at compile time.
Remarks
Unlike the similar vector<bool> Class, the bitset class does not have iterators and is not an Standard Template Library container. It also differs from vector<bool> by being of some specific size that is fixed at compile time in accordance with the size specified by the template parameter N when the bitset<N> is declared.
A bit is set if its value is 1 and reset if its value is 0. To flip or toggle a bit is to change its value from 1 to 0 or from 0 to 1. The N bits in a bitset are indexed by integer values from 0 to N - 1, where 0 indexes the first bit position and N* *- 1 the final bit position.
Requirements
Header: <bitset>
Namespace: std