Chapter 25. Working with Bit Flags Using STL

Bits can be a very efficient way of storing settings and flags. STL supplies classes that help organize and manipulate bitwise information. This lesson will introduce you to

The bitset Class

std::bitset is an STL class designed for handling information in bits and bit flags. The std::bitset is not classified as an STL container class because it cannot resize itself and does not exhibit other characteristics of containers, such as access via iterators. This is a utility class that is optimized for working with a sequence of bits whose length is known at compile-time.

Instantiating the std::bitset

This template class requires the inclusion of the header <bitset> and needs one ...

Get Sams Teach Yourself C++ in One Hour a Day, Sixth Edition 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.