First public contribution.
1 ///////////////////////////////////////////////////////////////////////////////
3 /// The proto expression template compiler and supporting utilities.
5 // Copyright 2004 Eric Niebler. Distributed under the Boost
6 // Software License, Version 1.0. (See accompanying file
7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_PROTO_HPP_EAN_04_01_2005
10 #define BOOST_PROTO_HPP_EAN_04_01_2005
12 #include <boost/xpressive/proto/proto_fwd.hpp>
13 #include <boost/xpressive/proto/op_tags.hpp>
14 #include <boost/xpressive/proto/op_base.hpp>
15 #include <boost/xpressive/proto/operators.hpp>
16 #include <boost/xpressive/proto/arg_traits.hpp>
18 namespace boost { namespace proto
20 ///////////////////////////////////////////////////////////////////////////////
22 template<typename Op, typename State, typename Visitor, typename DomainTag>
25 typedef typename as_op<Op>::type op_type;
26 typedef typename tag_type<op_type>::type tag_type;
27 typedef compiler<tag_type, DomainTag> compiler_type;
28 typedef typename compiler_type::BOOST_NESTED_TEMPLATE apply<op_type, State, Visitor>::type type;
31 ///////////////////////////////////////////////////////////////////////////////
33 template<typename Op, typename State, typename Visitor, typename DomainTag>
34 typename compile_result<Op, State, Visitor, DomainTag>::type const
35 compile(Op const &op, State const &state, Visitor &visitor, DomainTag)
37 typedef typename as_op<Op>::type op_type;
38 typedef compiler<typename tag_type<op_type>::type, DomainTag> compiler;
39 return compiler::call(as_op<Op>::make(op), state, visitor);
42 }} // namespace boost::proto