std::vector<bool, Alloc>::reference
The std::vector
<bool, Alloc> specializations define std::vector
<bool, Alloc>::reference as a publicly-accessible nested class. std::vector
<bool, Alloc>::reference proxies the behavior of references to a single bit in std::vector
<bool, Alloc>.
The primary use of std::vector
<bool, Alloc>::reference is to provide an assignable value that can be returned from operator[].
Any reads or writes to a vector that happen via a std::vector
<bool, Alloc>::reference potentially read or write to the entire underlying vector.
Contents
- 1 Member functions
- 2 std::vector<bool, Alloc>::reference::reference
- 3 std::vector<bool, Alloc>::reference::~reference
- 4 std::vector<bool, Alloc>::reference::operator=
- 5 std::vector<bool, Alloc>::reference::operator bool
- 6 std::vector<bool, Alloc>::reference::flip
- 7 std::formatter<std::vector<bool, Alloc>::reference>
[edit] Member functions
(public member function)
(public member function)
(public member function)
(public member function)
std::vector<bool, Alloc>::reference::reference
(constexpr since C++20)
Constructs the reference from another reference. The copy constructor is implicitly declared.(until C++11)
Other constructors can only be accessed by std::vector
<bool, Alloc>.
std::vector<bool, Alloc>::reference::~reference
Destroys the reference.
std::vector<bool, Alloc>::reference::operator=
(constexpr since C++20)
(constexpr since C++20)
Assigns a value to the referenced bit.
The const operator= enables std::vector<bool,Alloc>::iterator
to satisfy output_iterator
.
Parameters
Return value
*this
std::vector<bool, Alloc>::reference::operator bool
(constexpr since C++20)
Returns the value of the referenced bit.
Return value
The referenced bit.
std::vector<bool, Alloc>::reference::flip
(constexpr since C++20)
Inverts the referenced bit.
[edit] Helper classes
std::formatter<std::vector<bool, Alloc>::reference>
requires /*is-vector-bool-reference*/<T>
Specializes the std::formatter for std::vector
<bool, Alloc>::reference. The specialization uses std::formatter <bool, CharT> as its underlying formatter (denoted as underlying_
) where the referenced bit is converted to bool to be formatted.
The exposition-only constant /*is-vector-bool-reference*/<T> is true if and only if T
denotes the type std::vector
<bool, Alloc>::reference for some type Alloc
and std::vector
<bool, Alloc> is not a program-defined specialization.
Member functions
constexpr ParseContext::iterator parse( ParseContext& ctx );
FormatContext::iterator format( const T& r, FormatContext& ctx ) const;
underlying_
.parse(ctx);.
underlying_
.format(r, ctx);.
[edit] Example
Reason: no example
[edit] See also
[edit] External links
std::vector<bool>::reference
).