15.8. Class bitset
Class bitset makes it easy to create and manipulate bit sets, which are useful for representing a set of bit flags.
bitsets are fixed in size at compile time. Class
bitset is an alternate tool for bit manipulation, discussed in Chapter 20.
bitset< size > b;
bitset b, in which every on of the
size bits is initially
b.set( bitNumber );
bitset b “on.” The expression
b.set() sets all bits in
b.reset( bitNumber );
bitset b “off.” The expression
b.reset() sets all bits in
b.flip( bitNumber );
bitset b (e.g., if the bit is “on”,
flip sets it “off”). The expression ...