C++ 位集库 - reference() 函数


描述

C++ std::bitset::reference是嵌入式类,它提供可以从std::bitset::operator[]返回的左值。通过std::bitset::reference对位集执行的任何读取或写入操作最终都会读取或写入整个底层位集。

宣言

以下是 std::bitset::reference 类形式 std::bitset 标头的声明。

C++98

class bitset::reference {
   friend class bitset;
   reference();		/* Private constructor */
public:
   ~reference();
   operator bool() const;
   reference& operator = (bool x);
   reference& operator = (const reference& x);
   reference& flip();
   bool operator~() const;
}

C++11

class bitset::reference {
   friend class bitset;
   reference() noexcept;		/* Private constructor */
public:
   ~reference();
   operator bool() const noexcept;
   reference& operator= (bool x) noexcept;
   reference& operator= (const reference& x) noexcept;
   reference& flip() noexcept;
   bool operator~() const noexcept;
}
位集.htm