在线文档教程
C++
应用 | Utilities

std::bitset::reference

STD::位集::参考

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 boolreturns the referenced bit (public member function)
operator ~returns inverted referenced bit (public member function)
flipflips 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)

© cppreference.com

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

http://en.cppreference.com/w/cpp/实用程序/位集/参考