std::bitset::to_ullong
STD::位集::to[医]乌龙
unsigned long long to_ullong() const | | (since C++11) |
---|
将位集的内容转换为unsigned long long
整数。
该位集的第一位对应于所述数字的最小有效位数,而所述最后一位对应于所述最有效位数。
参数
%280%29
返回值
转换的整数。
例外
std::overflow_error
如果值不能表示为unsigned long long
...
例
二次
#include <iostream>
#include <bitset>
#include <limits>
int main()
{
std::bitset<std::numeric_limits<unsigned long long>::digits> b(
0x123456789abcdef0LL
std::cout << b << " " << std::hex << b.to_ullong() << '\n';
b.flip(
std::cout << b << " " << b.to_ullong() << '\n';
}
二次
产出:
二次
0001001000110100010101100111100010011010101111001101111011110000 123456789abcdef0
1110110111001011101010011000011101100101010000110010000100001111 edcba9876543210f
二次
另见
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) |
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。