C++ 位集庫 - reference() 函式



描述

C++ 的 std::bitset::reference 是一個嵌入式類,它提供可以從std::bitset::operator[]返回的左值。透過std::bitset::reference對位集執行的任何讀寫操作最終都會讀寫整個底層位集。

宣告

以下是來自 std::bitset 標頭檔案的 std::bitset::reference 類的宣告。

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;
}
bitset.htm
廣告