1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #ifndef PHOENIX_OPERATOR_IO_HPP
8 #define PHOENIX_OPERATOR_IO_HPP
10 #include <boost/spirit/home/phoenix/operator/detail/io.hpp>
12 namespace boost { namespace phoenix
14 ///////////////////////////////////////////////////////////////////////////////
16 // overloads for std::basic_ostream and std::basic_istream
18 ///////////////////////////////////////////////////////////////////////////////
19 template <typename T0, typename T1>
20 inline typename detail::enable_if_ostream<T0, T1>::type
21 operator<<(T0& a0, actor<T1> const& a1)
23 return compose<shift_left_eval>(phoenix::ref(a0), a1);
26 template <typename T0, typename T1>
27 inline typename detail::enable_if_istream<T0, T1>::type
28 operator>>(T0& a0, actor<T1> const& a1)
30 return compose<shift_right_eval>(phoenix::ref(a0), a1);
33 // resolve ambiguities with fusion.
34 template <typename T1>
35 inline typename detail::enable_if_ostream<std::ostream, T1>::type
36 operator<<(std::ostream& a0, actor<T1> const& a1)
38 return compose<shift_left_eval>(phoenix::ref(a0), a1);
41 template <typename T1>
42 inline typename detail::enable_if_istream<std::istream, T1>::type
43 operator>>(std::istream& a0, actor<T1> const& a1)
45 return compose<shift_right_eval>(phoenix::ref(a0), a1);
48 ///////////////////////////////////////////////////////////////////////////////
50 // overloads for I/O manipulators.
52 ///////////////////////////////////////////////////////////////////////////////
53 template <typename T0>
54 inline actor<typename as_composite<
55 shift_left_eval, actor<T0>, detail::omanip_type>::type>
56 operator<<(actor<T0> const& a0, detail::omanip_type a1)
58 return compose<shift_left_eval>(a0, a1);
61 template <typename T0>
62 inline actor<typename as_composite<
63 shift_left_eval, actor<T0>, detail::iomanip_type>::type>
64 operator<<(actor<T0> const& a0, detail::iomanip_type a1)
66 return compose<shift_left_eval>(a0, a1);
69 template <typename T0>
70 inline actor<typename as_composite<
71 shift_right_eval, actor<T0>, detail::imanip_type>::type>
72 operator>>(actor<T0> const& a0, detail::imanip_type a1)
74 return compose<shift_right_eval>(a0, a1);
77 template <typename T0>
78 inline actor<typename as_composite<
79 shift_right_eval, actor<T0>, detail::iomanip_type>::type>
80 operator>>(actor<T0> const& a0, detail::iomanip_type a1)
82 return compose<shift_right_eval>(a0, a1);