...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template <class CharType, class CharTrait, class T> std::basic_ostream<CharType, CharTrait>& operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> const& v);
v
contains a value, the output contains result of calling out <<
*v
.
out
.
template <class CharType, class CharTrait, class T> std::basic_ostream<CharType, CharTrait>& operator<<(std::basic_ostream<CharType, CharTrait>& out, none_t);
out
.
template <class CharType, class CharTrait, class T> std::basic_ostream<CharType, CharTrait>& operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v);
T
is DefaultConstructible
and
MoveConstructible
.
in
. If
the string representation indicates that the optional object should
contain a value, v
contains a value and its contained value is obtained as if by default-constructing
an object o
of type
T
and then calling
in >>
o
; otherwise v
does not contain a value, and the
previously contained value (if any) has been destroyed.
out
.