Hello Boost.Proto,
firstly, thank you very much for your great work for providing such a
powerful framework.
My Setup: I defined a grammar, like grammar * grammar, a domain and so on.
Based on the domain two evaluator for different contexts are provided. For
standard operators that works great.
For expression evaluation I have a function defined as follow:
template
generate (T& t, Expr const& expr, Arg0 const& arg0, ... )
{
call the first or the second evaluator switched by T and passes the value
arg0, ...
}
Therewith, I can write for example, generate (foo, _1 * _2, a, b);
Coming to my problem. I would like to write, generate (foo, _1 * func (_2,
_3), a ,b, c); Overall I would like to embedd function
calls into the expression and the pass them to the generate function.
I tried to implement a make_expr based on func, but that does not work for
me, i.e., compiler error for fmi::ite (_0, _1, _2) (a,b,c);
error: invalid use of incomplete type 'struct
fmi::ite_::result,
boost::fusion::vector1,
boost::fusion::vector1)>'
error: declaration of 'struct
fmi::ite_::result,
boost::fusion::vector1,
boost::fusion::vector1)>'
cpp:7:
Can you imaging what the problem is? Otherwise I will attach further cleaned
code.
struct ite_
{
template<typename Sig>
struct result;
template
struct result
: fusion::result_of::make_vector<bv> {};
template
fusion::result_of::make_vector<bv>::type operator() (If const& _if,
Then const& _then, Else const& _else) const
{
bv test;
/// some more code
return fusion::make_vector (test);
}
};
template
typename proto::result_of::make_expr::type
ite (If const& _if, Then const& _then, Else const& _else)
{
return proto::make_expr(
ite_()
, boost::ref(_if)
, boost::ref(_then)
, boost::ref(_else));
}
Examplarily, the placeholder definition:
typedef constraint > >::type>
var0_type
Best wishes,
sfrehse