bitset没有会员ullong

时间:2014-04-25 13:25:13

标签: c++ bitset

我试图实现以下代码,但是我遇到了错误。那是为什么?

#include <iostream>
#include <bitset>

int main()
{
    const std::string s = "0010111100011100011";
    unsigned long long value = std::bitset<64>(s).to_ullong();
    std::cout << value << std::endl;
}

我收到以下错误。

prog.cpp: In function ‘int main()’:
prog.cpp:7: error: ‘class std::bitset<64u>’ has no member named ‘to_ullong’ stdout

1 个答案:

答案 0 :(得分:1)

从C ++ 11开始,

std::bitset::to_ullong可用。

http://ideone.com/RpMR2A

http://en.cppreference.com/w/cpp/utility/bitset