Imported Upstream version 1.51.0
[platform/upstream/boost.git] / boost / spirit / home / phoenix / operator / io.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2007 Joel de Guzman
3
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
9
10 #include <boost/spirit/home/phoenix/operator/detail/io.hpp>
11
12 namespace boost { namespace phoenix
13 {
14 ///////////////////////////////////////////////////////////////////////////////
15 //
16 //  overloads for std::basic_ostream and std::basic_istream
17 //
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)
22     {
23         return compose<shift_left_eval>(phoenix::ref(a0), a1);
24     }
25
26     template <typename T0, typename T1>
27     inline typename detail::enable_if_istream<T0, T1>::type
28     operator>>(T0& a0, actor<T1> const& a1)
29     {
30         return compose<shift_right_eval>(phoenix::ref(a0), a1);
31     }
32
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)
37     {
38         return compose<shift_left_eval>(phoenix::ref(a0), a1);
39     }
40
41     template <typename T1>
42     inline typename detail::enable_if_istream<std::istream, T1>::type
43         operator>>(std::istream& a0, actor<T1> const& a1)
44     {
45         return compose<shift_right_eval>(phoenix::ref(a0), a1);
46     }
47
48 ///////////////////////////////////////////////////////////////////////////////
49 //
50 //  overloads for I/O manipulators.
51 //
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)
57     {
58         return compose<shift_left_eval>(a0, a1);
59     }
60
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)
65     {
66         return compose<shift_left_eval>(a0, a1);
67     }
68
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)
73     {
74         return compose<shift_right_eval>(a0, a1);
75     }
76
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)
81     {
82         return compose<shift_right_eval>(a0, a1);
83     }
84 }}
85
86 #endif