Boost logo

Proto :

Subject: [proto] Using make_expr with as_child or as_expr
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-04-18 09:44:41

make_expr is a fairly "funny" function, in that it decides whether the
children should be taken by value or reference depending on whether
they're wrapped in boost::(c)ref or not.

In some cases, I really want to write something like


but that kind of thing doesn't work, due to the funny way make_expr works.

I guess the perfect solution would be for make_expr to detect whether
its argument is an rvalue and take it by value in that case, and take by
reference otherwise.
But that could be tricky for a C++03 compiler.

I suggest that in the time being, variants of proto::make_expr be added:

proto::make_expr_expr(a0, a1) would take terminals by value and the rest
by reference

proto::make_expr_child(a0, a1) would take terminals by reference and the
rest by value

Names, of course, could be improved.

Maybe there is already some functions I missed that do what I want?

Proto list run by eric at