
joel wrote:
You'll have to post your code ... I can't tell what problem you might be running into. Well, I decided to be a coward for today. I'll shelf this functional solution for later. I just added my own ternary_expr & quaternary_expr class for the moment as it seems it's all the client wants. I'll come back when I've digested those infos as I htink I'm just doing a small error.
For reference here is the code I wrote:
namespace bp = boost::proto;
struct push_front_
Must inherit from bp::callable.
{ template<class Sig> struct result; template
struct result { typedef typename boost::fusion::result_of::push_front ::type type; }; template
typename result ::type operator()(Elem const& e, Seq& s ) const
Sequence and Element argument order is reversed here.
{ return boost::fusion::push_front(s,e); } };
struct _load : bp::transform< _load > { template
struct impl : bp::transform_impl { typedef typename meta::strip<Expr>::type::value_type result_type; result_type operator()( typename impl::expr_param expr , typename impl::state_param , typename impl::data_param data ) const { return expr(data); } }; };
struct eval_xpr : bp::or_< bp::when< bp::terminal< blockbp::_,bp::_ > , _load(bp::_) > , bp::when< bp::nary_expr< bp::_, bp::vararg
> , bp::functional::unpack_exprbp::tag::function(
This will create the new expression but not evaluate it. I had incorrectly told you to use bp::function<> here for its pass-through transform, but that's not actually what you want. You want Proto's _default transform.
push_front_(bp::_, bp::terminal
bp::_ > >() ) ) ) > > {};
Here is some code that should get you going again:
#include