Boost logo

Boost Users :

Subject: Re: [Boost-users] [proto] learning proto slowly, a small (math)complex library
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2011-01-10 06:53:36


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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net