Game Development Reference
In-Depth Information
Figure 18-1. The output generated by executing the code in Listing 18-3
There are also helper methods that can tell you if any , all , or none of the bits are set. Finally you can
see two methods to query the status of individual bits. You can either use the array operator and
index or you can use the test method.
There are three methods supplied that allow you to alter the values stored in the bitset . These are
shown in Listing 18-4.
Listing 18-4. Altering Bits
stringConstructor.set(1, false);
stringConstructor.set(1);
stringConstructor.set();
stringConstructor.reset(0);
stringConstructor.reset();
stringConstructor.flip(4);
stringConstructor.flip();
The three methods are set , reset , and flip . Figure 18-2 shows the results of these lines of code in
the order in which they appear in Listing 18-4.
 
Search WWH ::




Custom Search