首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::bitset

Defined in header <bitset>

?

?

template< std::size_t N > class bitset;

?

?

类模板bitset表示一个固定大小的序列。N比特。Bitset可以由标准逻辑运算符操作,并转换成字符串和整数。

bitset满足…的要求CopyConstructibleCopyAssignable...

模板参数

N

-

the number of bits to allocate storage for

成员类型

reference

proxy class representing a reference to a bit (class)

成员函数

(constructor)

constructs the bitset (public member function)

operator==operator!=

compares the contents (public member function)

元素存取

操作者。[访问特定位%28公共成员函数%29

测试访问特定位%28公共成员函数%29

如果所有位、任何位或无位被设置为真%28公共成员函数%29,则检查

Count返回设置为true%28公共成员函数%29的位数。

容量

Size返回位集可以容纳%28公共成员函数%29的位数。

修饰符

算子&=算子=运算符^=操作符~执行二进制和,OR,XOR而非%28公共成员函数%29

运算符<<=运算符>>=运算符<<operator>>执行二进制移位左移和右移%28公共成员函数%29

将位设置为true或给定值%28公共成员函数%29

重置将位设置为false%28公共成员函数%29

翻转切换位%28公共成员函数%29的值

转换

到[医]字符串返回数据%28公共成员函数%29的字符串表示形式。

到[医]Ulong返回数据%28公共成员函数%29的无符号长整数表示形式。

到[医]超长%28C++11%29返回数据%28公共成员函数%29的无符号长整数表示形式

非会员职能

operator&operator|operator^

performs binary logic operations on bitsets (function template)

operator<<operator>>

performs stream input and output of bitsets (function template)

帮助者类

std::hash<std::bitset> (C++11)

hash support for std::bitset (class template specialization)

注记

如果在编译时不知道位集的大小,STD::向量<bool>或助推::动态[医]位集可能会被使用。

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com