/////////////////////////////////////////////////////////////////////////////// /// \file compose.hpp /// A special-purpose proto transform for composing two transfomations. Given /// two Grammars, expressions that match the first grammar are transformed /// according to that grammar, and the result is forwarded to the second /// for further transformation. // // Copyright 2007 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PROTO_TRANSFORM_COMPOSE_HPP_EAN_04_01_2007 #define BOOST_PROTO_TRANSFORM_COMPOSE_HPP_EAN_04_01_2007 #include #include // mpl::true_ #include #include namespace boost { namespace proto { namespace transform { // Composes two transforms template struct compose : Grammar1 { compose() {} template struct apply { typedef typename Grammar2::template apply< typename Grammar1::template apply::type , State , Visitor >::type type; }; template static typename apply::type call(Expr const &expr, State const &state, Visitor &visitor) { return Grammar2::call(Grammar1::call(expr, state, visitor), state, visitor); } }; }}} namespace boost { namespace proto { template struct is_transform > : mpl::true_ {}; }} #endif