Boost logo

Boost :

From: Maurizio Vitale (mav_at_[hidden])
Date: 2007-07-17 12:36:52

Eric Niebler <eric_at_[hidden]> writes:

> Maurizio, deep_copy() alone will not work here. The user is creating a
> lambda expression and assigning it directly to function<>:
> function<int(int&,int&)> f(_0 + _1);
> function<> knows nothing about proto expressions, and doesn't know to
> call proto::deep_copy().

Rats! (apologizes to Dan, I didn't intend to mislead)

But now I'd appreciate you entering "grade school mode" and do some explaining.

My mental model was:
   - proto::deep_copy traverse the expression top-down replacing references with value.

   - generators are used to wrap expressions as they are built bottom-up

So, assuming that the expression is properly wrapped in lambda_expr<> why the result
of calling proto::expr on the whole expression would be different from using the generator?

And why this would tell function<> more about proto expressions?

What am I missing?



Boost list run by bdawes at, gregod at, cpdaniel at, john at