Boost logo

Boost :

From: Maurizio Vitale (mav_at_[hidden])
Date: 2007-05-22 21:25:17


Eric Niebler <eric_at_[hidden]> writes:

>> Unless there's something stupid in my code.

I thought so :-)

>
> Essentially, what you're doing is:
>
> BOOST_TYPEOF(some + proto + expr) e = some + proto + expr;
> // Use e
>
> It doesn't work quite like this. The reason why is that "some + proto +
> expr" is a tree where some of the nodes are temporary objects, which are
> held by reference by other nodes. It's a castle in the air, and at the
> semicolon, it crashes down.
>
> You need proto::deep_copy():

It doesn't quite work because it seems deep_copy doesn't (seem to) use
generate for wrapping up expression, with the result that the type of
the object returned by deep_copy is deeply different from the type
sent in.

But this is not the reason I didn't use it, more simply, I forgot
about it.

Question: once deep_copy is fixed (or you show me how to use it in my context),
would it be usable for initializing a static member variable?

Regards,

        Maurizio


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk