C++ bitsetのお話
bitsetについて調べたことをまとめておきます。
bitsetとは
配列である。
配列のすべての要素は0か1である。集合などに使うと便利だったりする。
サンプルコード
#include <bitset> //宣言方法 bitset<8> a(a1); //10進数にする cout << a.to_ullong() << endl;
bitset<ビット数> a(bitsetにする変数)
()に入る変数はstringやint型でも可
bitsetについて調べたことをまとめておきます。
配列である。
配列のすべての要素は0か1である。集合などに使うと便利だったりする。
#include <bitset> //宣言方法 bitset<8> a(a1); //10進数にする cout << a.to_ullong() << endl;
bitset<ビット数> a(bitsetにする変数)
()に入る変数はstringやint型でも可