
10 Jan
2011
10 Jan
'11
11:53 a.m.
On 10/01/11 11:47, alfC wrote:
1) is this true? Yes
2) if yes, then that means that one of the 2 types (type complex or typeof(4.+5.*i) ), will have to be modified (or extendended) in other to accept this syntax. 3) if no , how can I allow this syntax?
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. Incidentally, i am using this very same example in a courses on DSEL design in C++ i am starting to write atm. So i can shed some light if you want.