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

std::bitset::reference

class reference;

std::bitset类包括std::bitset::reference作为一个可公开访问的嵌套类。此类用作代理对象,允许用户与位集的单个位进行交互,因为标准C++类型%28类引用和指针%29的构建不够精确,无法指定单个位。

主要用途std::bitset::reference提供一个可以从operator[]...

通过std::bitset::reference可能会读取或写入整个基础位集。

成员函数

(constructor)

constructs the reference. Accessible only to std::bitset itself (private member function)

(destructor)

~reference (public member function)

operator=

assigns a bool to the referenced bit (public member function)

operator bool

returns the referenced bit (public member function)

operator ~

returns inverted referenced bit (public member function)

flip

flips the referenced bit (public member function)

STD::位集<N>*参考::~参考

~reference()

摧毁了引用。

STD::位集<N>*参考::操作员=

reference& operator=( bool x ); reference& operator=( const reference& x );

为引用的位分配一个值。

参数

x

-

value to assign

返回值

*this...

例外

(none)

(until C++11)

noexcept specification: noexcept

(since C++11)

STD::位集<N>*参考资料::操作人员bool

operator bool() const;

返回引用位的值。

参数

%280%29

返回值

参考位。

例外

(none)

(until C++11)

noexcept specification: noexcept

(since C++11)

<N>*参考资料::操作员~

bool operator~() const;

返回引用位的逆位。

参数

%280%29

返回值

被引用位的逆位。

例外

(none)

(until C++11)

noexcept specification: noexcept

(since C++11)

STD::位集<N>*参考资料::翻转

reference& flip();

反转所引用的位。

参数

%280%29

返回值

*this...

例外

(none)

(until C++11)

noexcept specification: noexcept

(since C++11)

另见

operator[]

accesses specific bit (public member function)

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

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

扫码关注腾讯云开发者

领取腾讯云代金券