See the boostcon slides of Eric last year. All you need is to give your complex expression an operator to cast itself to std::complex in which you evaluate the expression real and imag part and retrun the newly constructed std::complex out of it.
great, nice resource.
I translated the map_list_of example into the complex example. There
is still work to do, the code doesn't work yet. I guess I have to
still tell proto that "complex_cartesian_expr" (didn't know what other
name to put) is of type proto::plus< proto::terminal<double> ,
proto::multiplies
. I don't know how to do that. complete code at the end of the email.
Incidentally, i am using this very same example in a courses on DSEL design in C++ i am starting to write atm.
I knew it could be a natural example since most people know simple complex arithmetic and std::complex<double>.
So i can shed some light if you want.
That would be great. Any help is greatly appreciated and I promise my
feedback.
----
#include