August 2012
Intermediate to advanced
976 pages
30h 17m
English
bitsetsTable 17.2 (overleaf) lists the constructors for bitset. The bitset class is a class template that, like the array class, has a fixed size (§ 9.2.4, p. 336). When we define a bitset, we say how many bits the bitset will contain:
bitset<32> bitvec(1U); // 32 bits; low-order bit is 1, remaining bits are 0
Table 17.2. Ways to Initialize a bitset
The size must be a constant expression (§ 2.4.4, p. 65). This statement defines bitvec as a bitset that holds 32 bits. Just as with the elements of a vector, the bits in a bitset are not named. Instead, we refer to them positionally. The bits are numbered starting ...
Read now
Unlock full access