1 // Copyright (C) 2005, Fernando Luis Cacciola Carballal.
\r
3 // Use, modification, and distribution is subject to the Boost Software
\r
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
\r
5 // http://www.boost.org/LICENSE_1_0.txt)
\r
7 // See http://www.boost.org/lib/optional for documentation.
\r
9 // You are welcome to contact the author at:
\r
10 // fernando_cacciola@hotmail.com
\r
12 #ifndef BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
\r
13 #define BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP
\r
15 #if defined __GNUC__
\r
16 # if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97)
\r
17 # define BOOST_OPTIONAL_NO_TEMPLATED_STREAMS
\r
21 #if defined BOOST_OPTIONAL_NO_TEMPLATED_STREAMS
\r
22 # include <iostream>
\r
29 #include "boost/optional/optional.hpp"
\r
30 #include "boost/utility/value_init.hpp"
\r
35 #if defined (BOOST_NO_TEMPLATED_STREAMS)
\r
37 inline std::ostream& operator<<(std::ostream& out, optional<T> const& v)
\r
39 template<class CharType, class CharTrait, class T>
\r
41 std::basic_ostream<CharType, CharTrait>&
\r
42 operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> const& v)
\r
49 else out << ' ' << *v ;
\r
55 #if defined (BOOST_NO_TEMPLATED_STREAMS)
\r
57 inline std::istream& operator>>(std::istream& in, optional<T>& v)
\r
59 template<class CharType, class CharTrait, class T>
\r
61 std::basic_istream<CharType, CharTrait>&
\r
62 operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v)
\r
81 } // namespace boost
\r