[/ Boost.Optional Copyright (c) 2003-2007 Fernando Luis Cacciola Carballal Copyright (c) 2015 Andrzej Krzemienski Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ] [section:io_header Header ] [section:io_synop Synopsis] ``` #include #include #include namespace boost { template std::basic_ostream& operator<<(std::basic_ostream& out, optional const& v); ``[link reference_operator_ostream __GO_TO__]`` template std::basic_ostream& operator<<(std::basic_ostream& out, none_t const&); ``[link reference_operator_ostream_none __GO_TO__]`` template std::basic_istream& operator>>(std::basic_istream& in, optional& v); ``[link reference_operator_istream __GO_TO__]`` } // namespace boost ``` [endsect] [section:io_semantics Detailed semantics] [#reference_operator_ostream] `template ` [br] \u00A0\u00A0\u00A0\u00A0`std::basic_ostream&` [br] \u00A0\u00A0\u00A0\u00A0`operator<<(std::basic_ostream& out, optional const& v);` * [*Effect:] Outputs an implementation-defined string. The output contains the information about whether the optional object contains a value or not. If `v` contains a value, the output contains result of calling `out << *v`. * [*Returns:] `out`. __SPACE__ [#reference_operator_ostream_none] `template ` [br] \u00A0\u00A0\u00A0\u00A0`std::basic_ostream&` [br] \u00A0\u00A0\u00A0\u00A0`operator<<(std::basic_ostream& out, none_t);` * [*Effect:] Outputs an implementation-defined string. * [*Returns:] `out`. __SPACE__ [#reference_operator_istream] `template ` [br] \u00A0\u00A0\u00A0\u00A0`std::basic_ostream&` [br] \u00A0\u00A0\u00A0\u00A0`operator>>(std::basic_istream& in, optional& v);` * [*Requires:] `T` is __SGI_DEFAULT_CONSTRUCTIBLE__ and __MOVE_CONSTRUCTIBLE__. * [*Effect:] Reads the value of optional object from `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. * [*Returns:] `out`. [endsect] [endsect]