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
On 4/29/2010 9:44 PM, Robert Valkenburg wrote:
When the expression is transformed some instances of the ga_expr<> wrapper get removed. For example <snip>
This sounds like a bug in the pass_through transform. Can you file a bug (https://svn.boost.org/trac/boost/) with the faulty code and I'll investigate when I have a sec. Note: I'll be super-busy until after BoostCon. :-( Thanks, -- Eric Niebler BoostPro Computing http://www.boostpro.com
On Fri, Apr 30, 2010 at 5:37 PM, Eric Niebler <eric@boostpro.com> wrote:
This sounds like a bug in the pass_through transform. Can you file a bug (https://svn.boost.org/trac/boost/) with the faulty code and I'll investigate when I have a sec.
Thanks for the quick response. Sure i'll file a bug report, but i'm not convinced its not just me misunderstanding something. BTW Proto (+ MPL) is very cool - i'm optimising geometric algebra expressions that i would not have really considered practically tractable before.
Robert Valkenburg wrote: <snip> I never encountered that with my own set of transform. Do you have a small code that cna be compiled out of nowehere ?
On Fri, Apr 30, 2010 at 6:27 PM, Joel Falcou <joel.falcou@lri.fr> wrote:
I never encountered that with my own set of transform.
Do you have a small code that cna be compiled out of nowehere ?
I will prepare the smallest self contained fragment i can get away with and post tomorrow.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Fri, Apr 30, 2010 at 6:27 PM, Joel Falcou <joel.falcou@lri.fr> wrote:
I never encountered that with my own set of transform.
Do you have a small code that cna be compiled out of nowehere ?
I've attached a smallish (~160 lines) file that only depends on "boost/proto/proto.hpp" I still get the unwrapping (gcc 4.4.1 linux FC 11, x86_64 platform) as follows g++ -Wall -I/home/users/robert/linux_x86_64/src/boost_1_42_0 test_boost_proto.cpp -o test_boost_proto test_boost_proto.cpp: In function ‘void clifford::evaluate(Res&, const clifford::ga_expr<Expr>&) [with Res = clifford::multivector<clifford::cga3::rotator_basis, clifford::cga3::cga3>, 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::multivector<clifford::cga3::ebivector_basis, clifford::cga3::cga3>&>, 0l> > >, 1l>]’: test_boost_proto.cpp:126: instantiated from ‘clifford::multivector<B, A>& clifford::multivector<B, A>::operator=(const clifford::ga_expr<T>&) [with T = 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::multivector<clifford::cga3::ebivector_basis, clifford::cga3::cga3>&>, 0l> > >, 1l>, B = clifford::cga3::rotator_basis, A = clifford::cga3::cga3]’ test_boost_proto.cpp:164: instantiated from here test_boost_proto.cpp:103: error: no matching function for call to ‘evaluate_expr(clifford::multivector<clifford::cga3::rotator_basis, clifford::cga3::cga3>&, 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::multivector<clifford::cga3::ebivector_basis, clifford::cga3::cga3>&>, 0l> >&>, 1l>)’
participants (3)
-
Eric Niebler
-
Joel Falcou
-
Robert Valkenburg