class reference; |
The std::bitset
class includes std::bitset::reference
as a publicly-accessible nested class. This class is used as a proxy object to allow users to interact with individual bits of a bitset, since standard C++ types (like references and pointers) are not built with enough precision to specify individual bits.
The primary use of std::bitset::reference
is to provide an l-value that can be returned from operator[]
.
Any reads or writes to a bitset that happen via a std::bitset::reference
potentially read or write to the entire underlying bitset.
(constructor) | constructs the reference. Accessible only to std::bitset itself (private member function) |
(destructor) | destroys the 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) |
~reference() |
Destroys the reference.
reference& operator=( bool x ); reference& operator=( const reference& x ); |
Assigns a value to the referenced bit.
x | - | value to assign |
*this
.
(none) | (until C++11) |
noexcept specification: noexcept | (since C++11) |
operator bool() const; |
Returns the value of the referenced bit.
(none).
The referenced bit.
(none) | (until C++11) |
noexcept specification: noexcept | (since C++11) |
bool operator~() const; |
Returns the inverse of the referenced bit.
(none).
The inverse of the referenced bit.
(none) | (until C++11) |
noexcept specification: noexcept | (since C++11) |
reference& flip(); |
Inverts the referenced bit.
(none).
*this
.
(none) | (until C++11) |
noexcept specification: noexcept | (since C++11) |
accesses specific bit (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/bitset/reference