os/ossrv/ossrv_pub/boost_apis/boost/xpressive/proto/proto.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200 (2012-06-15)
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 ///////////////////////////////////////////////////////////////////////////////
     2 /// \file proto.hpp
     3 /// The proto expression template compiler and supporting utilities.
     4 //
     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)
     8 
     9 #ifndef BOOST_PROTO_HPP_EAN_04_01_2005
    10 #define BOOST_PROTO_HPP_EAN_04_01_2005
    11 
    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>
    17 
    18 namespace boost { namespace proto
    19 {
    20     ///////////////////////////////////////////////////////////////////////////////
    21     // compile_result
    22     template<typename Op, typename State, typename Visitor, typename DomainTag>
    23     struct compile_result
    24     {
    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;
    29     };
    30 
    31     ///////////////////////////////////////////////////////////////////////////////
    32     // compile
    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)
    36     {
    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);
    40     }
    41 
    42 }} // namespace boost::proto
    43 
    44 #endif