Unlike access operator ([]), this function perform a range check on pos before retrieveing the bit value.
Parameters
- pos
- Order position of the bit whose value is flipped.
Order positions are counted from the rightmost bit, which is order position 0.
size_t is an unsigned integral type.
Return value
true if bit at position pos is set, and false otherwise.If pos is not a valid bit position, out_of_range is thrown.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Output:
mybits contains: true true false true false |
See also
| bitset::operator[] | Access bit (public member function) |
| bitset::count | Count bits set (public member function) |
| bitset::any | Test if any bit is set (public member function) |
| bitset::none | Test if no bit is set (public member function) |
