最終更新日時(UTC):
が更新

履歴 編集

function template
<bitset>

std::operator<<

namespace std {
  template <class CharT, class Traits, size_t N>
  basic_ostream<CharT, Traits>&
    operator<<(basic_ostream<CharT, Traits>& os, const bitset<N>& x);
}

概要

2進数表記でストリームに出力する。

戻り値

os << x.template to_string<CharT, Traits, allocator<CharT>>(
        use_facet<ctype<CharT>>(os.getloc()).widen('0'),
        use_facet<ctype<CharT>>(os.getloc()).widen('1'));

#include <iostream>
#include <bitset>

int main()
{
  std::bitset<4> bs(10uL);

  std::cout << bs << std::endl;
}

出力

1010

参照