Defined in header <bitset> | ||
---|---|---|
template< std::size_t N > class bitset; |
The class template bitset
represents a fixed-size sequence of N
bits. Bitsets can be manipulated by standard logic operators and converted to and from strings and integers.
bitset
meets the requirements of CopyConstructible and CopyAssignable.
N | - | the number of bits to allocate storage for |
proxy class representing a reference to a bit (class) |
constructs the bitset (public member function) |
|
compares the contents (public member function) |
|
Element access |
|
accesses specific bit (public member function) |
|
accesses specific bit (public member function) |
|
(C++11) | checks if all, any or none of the bits are set to true (public member function) |
returns the number of bits set to true (public member function) |
|
Capacity |
|
returns the size number of bits that the bitset can hold (public member function) |
|
Modifiers |
|
performs binary AND, OR, XOR and NOT (public member function) |
|
performs binary shift left and shift right (public member function) |
|
sets bits to true or given value (public member function) |
|
sets bits to false (public member function) |
|
toggles the values of bits (public member function) |
|
Conversions |
|
returns a string representation of the data (public member function) |
|
returns an unsigned long integer representation of the data (public member function) |
|
(C++11) | returns an unsigned long long integer representation of the data (public member function) |
performs binary logic operations on bitsets (function template) |
|
performs stream input and output of bitsets (function template) |
(C++11) | hash support for std::bitset (class template specialization) |
If the size of the bitset is not known at compile time, std::vector<bool> or boost::dynamic_bitset may be used.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/bitset