1 /*==============================================================================
2 Copyright (c) 2001-2010 Joel de Guzman
3 Copyright (c) 2010 Thomas Heller
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #ifndef BOOST_PHOENIX_OPERATOR_IO_HPP
9 #define BOOST_PHOENIX_OPERATOR_IO_HPP
13 #include <boost/phoenix/core/limits.hpp>
14 #include <boost/fusion/sequence/intrinsic/at.hpp>
15 #include <boost/phoenix/core/domain.hpp>
16 #include <boost/proto/make_expr.hpp>
17 #include <boost/proto/tags.hpp>
18 #include <boost/proto/operators.hpp>
20 namespace boost { namespace phoenix
24 typedef std::ios_base& (*iomanip_type)(std::ios_base&);
25 typedef std::istream& (*imanip_type)(std::istream&);
26 typedef std::ostream& (*omanip_type)(std::ostream&);
29 /////////////////////////////////////////////////////////////////////////////
31 // overloads for I/O manipulators.
33 /////////////////////////////////////////////////////////////////////////////
34 template <typename Expr>
36 typename proto::result_of::make_expr<
37 proto::tag::shift_left
40 , detail::iomanip_type
42 operator<<(actor<Expr> const& a0, detail::iomanip_type a1)
44 return proto::make_expr<
45 proto::tag::shift_left, phoenix_domain>(a0, a1);
48 template <typename Expr>
50 typename proto::result_of::make_expr<
51 proto::tag::shift_left
56 operator<<(actor<Expr> const& a0, detail::omanip_type a1)
58 return proto::make_expr<
59 proto::tag::shift_left, phoenix_domain>(a0, a1);
62 template <typename Expr>
64 typename proto::result_of::make_expr<
65 proto::tag::shift_right
68 , detail::iomanip_type
70 operator>>(actor<Expr> const& a0, detail::iomanip_type a1)
72 return proto::make_expr<
73 proto::tag::shift_right, phoenix_domain>(a0, a1);
76 template <typename Expr>
78 typename proto::result_of::make_expr<
79 proto::tag::shift_right
84 operator>>(actor<Expr> const& a0, detail::imanip_type a1)
86 return proto::make_expr<
87 proto::tag::shift_right, phoenix_domain>(a0, a1);
90 using proto::exprns_::operator<<;
91 using proto::exprns_::operator>>;