|
Boost Users : |
Subject: [Boost-users] [Proto] loosing expression wrappers in transforms
From: Robert Valkenburg (rj.valkenburg_at_[hidden])
Date: 2010-04-30 00:44:26
Hi,
I have a grammar, domain and an extended expression i.e.
struct ga_domain : proto::domain<proto::generator<ga_expr>, ga_grammar>
{};
template<typename Expr>
struct ga_expr : boost::proto::extends<Expr, ga_expr<Expr>, ga_domain>
{
// ....
};
When the expression is transformed some instances of the ga_expr<> wrapper
get removed. For example
// some function that expects a ga_expr<Expr> as 2nd arg
void evaluate_expr(Res& res, const ga_expr<Expr>& expr)
{
// ....
}
// some function which transforms the expression and calls evaluate_expr()
template <class Res, class Expr>
void evaluate(Res& res, const ga_expr<Expr>& expr)
{
BOOST_MPL_ASSERT((proto::matches< ga_expr<Expr>, ga_grammar>));
evaluate_expr(res, ET::transform_expression()(expr) );
}
With the (do nothing) transform
struct transform_expression : proto::nary_expr<proto::_,
proto::vararg<transform_expression> > {};
I get the following messages (using gcc 4.4.1, boost 1.42)
In function void clifford::evaluate(Res&, const clifford::ga_expr<Expr>&)
[with Res =
clifford::element<clifford::basis::basis<clifford::cga3::basis::rotator_basis_list,
mpl_::integral_c<unsigned int, 105u> >, clifford::cga3::cga3,
clifford::default_tags>, Expr =
boost::proto::exprns_::expr<clifford::tag::reverse_,
boost::proto::argsns_::list1<clifford::ga_expr<boost::proto::exprns_::expr<boost::proto::tag::terminal,
boost::proto::argsns_::term<const
clifford::element<clifford::basis::basis<boost::mpl::vector10_c<short int,
3, 5, 6, 9, 10, 12, 17, 18, 20, 24>, mpl_::integral_c<unsigned int,
18224744u> >, clifford::cga3::cga3, clifford::default_tags>&>, 0l> > >,
1l>]:
error: no matching function for call to
evaluate_expr(clifford::element<clifford::basis::basis<clifford::cga3::basis::rotator_basis_list,
mpl_::integral_c<unsigned int, 105u> >, clifford::cga3::cga3,
clifford::default_tags>&,
boost::proto::exprns_::expr<clifford::tag::reverse_,
boost::proto::argsns_::list1<const
clifford::ga_expr<boost::proto::exprns_::expr<boost::proto::tag::terminal,
boost::proto::argsns_::term<const
clifford::element<clifford::basis::basis<boost::mpl::vector10_c<short int,
3, 5, 6, 9, 10, 12, 17, 18, 20, 24>, mpl_::integral_c<unsigned int,
18224744u> >, clifford::cga3::cga3, clifford::default_tags>&>, 0l> >&>,
1l>&)
So the clifford::ga_expr<> wrapper got removed from the unary reverse
operator and i'm not sure what i'm supposed to add to make it stay.
thanks
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net