#include #include #include #include #include namespace proto = boost::proto; namespace mpl = boost::mpl; template struct my_expr; struct generator : proto::transform { template struct impl : proto::transform_impl { typedef typename impl::expr expr; typedef typename proto::tag_of::type tag; typedef my_expr type; #if 1 typedef boost::proto::tag::plus tag_for_which_is_expr_should_be_avoided; #else typedef boost::proto::tag::function tag_for_which_is_expr_should_be_avoided; #endif typedef typename mpl:: if_< mpl:: and_< mpl:: not_< boost::is_same > , proto::is_expr > , type , type >::type result_type; result_type operator()( typename impl::expr_param e , typename impl::state_param , typename impl::data_param ) const { return result_type(e); } }; }; struct domain : proto::domain { }; template struct my_expr #if 1 : proto::extends, domain> { typedef proto::extends, domain> parent; my_expr(Expr const& expr = Expr()) : parent(expr) #else { BOOST_PROTO_BASIC_EXTENDS(Expr, my_expr, domain); my_expr(Expr const& expr = Expr()) : proto_expr_(expr) #endif { } }; template struct my_terminal : my_expr< typename proto::terminal::type > { }; int main() { my_terminal i, j; i + j; }