(C++17) | ||||
| Sequence | ||||
(C++11) | ||||
(C++26) | ||||
(C++26) | ||||
(C++11) | ||||
| Associative | ||||
| Unordered associative | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Adaptors | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
| Views | ||||
(C++20) | ||||
(C++23) | ||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
| Member types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vector<bool>::reference | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(C++11) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Deduction guides(C++17) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
class reference; | ||
Thestd::vector<bool, Alloc> specializations definestd::vector<bool, Alloc>::reference as a publicly-accessible nested class.std::vector<bool, Alloc>::reference proxies the behavior of references to a single bit instd::vector<bool, Alloc>.
The primary use ofstd::vector<bool, Alloc>::reference is to provide an assignable value that can be returned fromoperator[].
Any reads or writes to a vector that happen via astd::vector<bool, Alloc>::reference potentially read or write to the entire underlying vector.
(constructor) | constructs the reference (public member function) |
(destructor) | destroys the reference (public member function) |
operator= | assigns a value to the referenced bit (public member function) |
operator bool | returns the referenced bit (public member function)[edit] |
flip | flips the referenced bit (public member function) |
reference(const reference&)=default; | (since C++11) (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 bystd::vector<bool, Alloc>.
~reference(); | (constexpr since C++20) | |
Destroys the reference.
reference& operator=(bool x); | (1) | (noexcept since C++11) (constexpr since C++20) |
constexprconst reference& operator=(bool x)constnoexcept; | (2) | (since C++23) |
reference& operator=(const reference& x); | (3) | (noexcept since C++11) (constexpr since C++20) |
Assigns a value to the referenced bit.
The constoperator= enables | (since C++23) |
| x | - | value to assign |
*this
operatorbool()const; | (noexcept since C++11) (constexpr since C++20) | |
Returns the value of the referenced bit.
The referenced bit.
void flip(); | (noexcept since C++11) (constexpr since C++20) | |
Inverts the referenced bit.
template<class T,class CharT> requires/*is-vector-bool-reference*/<T> | (since C++23) | |
Specializes thestd::formatter forstd::vector<bool, Alloc>::reference. The specialization usesstd::formatter<bool, CharT> as its underlying formatter (denoted asunderlying_) where the referenced bit is converted tobool to be formatted.
The exposition-only constant/*is-vector-bool-reference*/<T> istrue if and only ifT denotes the typestd::vector<bool, Alloc>::reference for some typeAlloc andstd::vector<bool, Alloc> is not aprogram-defined specialization.
template<class ParseContext> constexpr ParseContext::iterator parse( ParseContext& ctx); | (1) | (since C++23) |
template<class FormatContext> FormatContext::iterator format(const T& r, FormatContext& ctx)const; | (2) | (since C++23) |
underlying_.parse(ctx);. underlying_.format(r, ctx);.| This section is incomplete Reason: no example |
| access specified element (public member function of std::vector<T,Allocator>)[edit] | |
[static] | swaps twostd::vector<bool>::references(public static member function)[edit] |
"Effective Modern C++" by Scott Meyers (2015), Chapter 2, Item 6: "Use the explicitly typed initializer idiom whenauto deduces undesired types." (p.43-46) — describes a possible misuse of the proxy classstd::vector<bool>::reference). |