
Eric Niebler <eric@boost-consulting.com> 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