Chapter 18
STL’s bitset
The last STL container type object that I cover is the bitset. I say STL type because the bitset is not strictly a container. It does not support iterators, the range-based for loops, or STL’s algorithms. A bitset is used for tracking individual boolean values in a combined set. A traditional method for achieving the same result are flags implemented using bitwise operators and shifts.
Creating bitset Objects
A bitset is yet another template provided by the STL. A major difference between a bitset and other STL containers is that you are not required to specify a type for the bitset. You can see in Listing 18-1 that the only parameter taken by the template is the number of bit flags we would like the bitset to contain. ...
Get Learn C++ for Game Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.