
Hi Eric,
Does the fact that I store formula_ by value (as in line ***) shoot the trouble of dangling references?
No, the problem still exists. You're storing the outer-most node by value, but all the inner nodes (temporary objects constructed while building the expression) are held by reference. At the very least, the constructor of MyClass needs to pass the incoming expression through deep_copy.
So, what about the following?
#define DEFINE_MY_CLASS(name, exp) \
MyClass
That article takes a sequence of function calls and turns them into a single callable object. You're taking a sequence of function calls and are turning them into a callable object.
I see. OK, so you're basically saying that the >> syntax can be avoided and that we can use simple function object composition instead with no need for Protofication. In that case, I need to say that this >> syntax is just a part of the larger syntax which fits very naturally to the application I'm developing for. Thanks a lot. :) --Hossein