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

proto::make_expr(
   proto::as_child(a0),
   proto::as_child(a1)
)

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 mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto

Reply via email to