C++核心技术:位图
4 分钟阅读
•
817 词
bitset
Member functions
| (constructor) | constructs the bitset (public member function) |
|---|---|
| operator==operator!= (removed in C++20) | compares the contents (public member function) |
| Element access | |
| operator[\] | accesses specific bit (public member function) |
| test | accesses specific bit (public member function) |
| allanynone | checks if all, any or none of the bits are set to true (public member function) |
| count | returns the number of bits set to true (public member function) |
| Capacity | |
| size | returns the number of bits that the bitset holds (public member function) |
| Modifiers | |
| operator&=operator|=operator^=operator~ | performs binary AND, OR, XOR and NOT (public member function) |
| operator<<=operator>>=operator<> | performs binary shift left and shift right (public member function) |
| set | sets bits to true or given value (public member function) |
| reset | sets bits to false (public member function) |
| flip | toggles the values of bits (public member function) |
| Conversions | |
| to_string | returns a string representation of the data (public member function) |
| to_ulong | returns an unsigned long integer representation of the data (public member function) |
| to_ullong (C++11) | returns an unsigned long long integer representation of the data (public member function) |