CppDS.com

C++ 98 11 14 17 20 手册

std::bitset<N>::reference

来自cppreference.com
< cpp‎ | utility‎ | bitset
 
 
工具库
通用工具
日期和时间
函数对象
格式化库 (C++20)
(C++11)
关系运算符 (C++20 中弃用)
整数比较函数
(C++20)
swap 与类型运算
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
常用词汇类型
(C++11)
(C++17)
(C++17)
(C++17)
(C++17)

初等字符串转换
(C++17)
(C++17)
 
 
class reference;

std::bitset 类包含 std::bitset::reference 作为可公开访问的嵌套类。此类用作允许用户与 bitset 的单个位交互的代理对象,因为标准 C++ 类型(如引用和指针)没有内建指定单个位的足够精度。

std::bitset::reference 的基本用途是提供能从 operator[] 返回的左值。

任何通过 std::bitset::reference 对 bitset 的读或写潜在地读或写整个底层 bitset 。

成员函数

(构造函数)
构造引用。只对 std::bitset 自身可访问
(私有成员函数)
(析构函数)
销毁引用
(公开成员函数)
operator=
赋值 bool 给被引用位
(公开成员函数)
operator bool
返回被引用位
(公开成员函数)
operator~
返回翻转的被引用位
(公开成员函数)
flip
翻转被引用位
(公开成员函数)

std::bitset<N>::reference::~reference

~reference();

销毁引用。

std::bitset<N>::reference::operator=

(1)
reference& operator=( bool x );
(C++11 前)
reference& operator=( bool x ) noexcept;
(C++11 起)
(2)
reference& operator=( const reference& x );
(C++11 前)
reference& operator=( const reference& x ) noexcept;
(C++11 起)

赋值给被引用位。

参数

x - 要赋值的值

返回值

*this

std::bitset<N>::reference::operator bool

operator bool() const;
(C++11 前)
operator bool() const noexcept;
(C++11 起)

返回被引用位的值。

参数

(无)

返回值

被引用位。

std::bitset<N>::reference::operator~

bool operator~() const;
(C++11 前)
bool operator~() const noexcept;
(C++11 起)

返回被引用位的翻转。

参数

(无)

返回值

被引用位的翻转。

std::bitset<N>::reference::flip

reference& flip();
(C++11 前)
reference& flip() noexcept;
(C++11 起)

翻转被引用位。

参数

(无)

返回值

*this

参阅

访问指定的位
(公开成员函数)
关闭