| Home | Libraries | People | FAQ | More

#### Detailed semantics

`template <class CharType, class CharTrait, class T>`
`std::basic_ostream<CharType, CharTrait>&`
`operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> 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`.

`template <class CharType, class CharTrait, class T>`
`std::basic_ostream<CharType, CharTrait>&`
`operator<<(std::basic_ostream<CharType, CharTrait>& out, none_t);`

- Effect: Outputs an implementation-defined string.
- Returns: `out`.

`template <class CharType, class CharTrait, class T>`
`std::basic_ostream<CharType, CharTrait>&`
`operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v);`

- Requires: `T` is `DefaultConstructible` and `MoveConstructible`.
- 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`.