std::bitset
cppreference.com
<tbody>
</tbody>
| <bitset> 에 정의되어 있음.
|
||
template< std::size_t N > class bitset; |
||
bitset 클래스 템플릿은 고정된 크기의 N 비트 순열을 표현할 수 있다. 표준 논리 연산자로 Bitset을 다룰 수 있으며, 문자열 및 정수로 전환하거나, 문자열 및 정수로 부터 전환될 수 있다.
bitset은 CopyConstructible와 CopyAssignable의 요구조건을 충족한다.
템플릿 인자
| N | - | 저장공간으로 할당할 비트의 갯수 |
멤버 형식
| 비트에 대한 참조자를 가리키는 프록시 클래스 (class) |
멤버 함수
틀:cpp/utility/bitset/dsc 생성자| 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 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) | |
비트를 true 또는 주어진 값으로 설정한다. (public member function) | |
비트를 false로 설정한다. (public member function) | |
| 비트의 값들을 반대로 뒤집는다. (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) | |
| performs stream input and output of bitsets (function) |
헬퍼 클래스
(C++11) |
hash support for std::bitset (class template specialization) |
노트
컴파일할 때 bitset의 크기를 모른다면 std::vector<bool>또는boost::dynamic_bitset를 사용해야 할 것이다.