Boost logo

Boost Users :

Subject: Re: [Boost-users] [proto] Question on grammar and operator overloading
From: joel (joel.falcou_at_[hidden])
Date: 2009-10-06 11:48:38


Hal Finkel wrote:
> Do you mean proto-izing std::complex itself (or some derived class), or
> using (extending) proto::terminal < std::complex >?
>
The later
> On a related note, is there a standard way (yet) of changing a single
> component of std::complex? I'm not sure that there is...
i always did z.imag() = x;
> My rationale for using an array value type was to make the
> interpretation of the type as a 2-element array clean. I'm working with
> several scientific codes which contain complex types defined as:
> typedef double complex_t[2]; and I'm preparing to port them to use more
> modern C++. However, I think that your point about the use of intrinsic
> functions is a good one.
>
Well, I ended up having an additional tempalte parameter (much like deque)
that may change the way the internal values are stored.

complex<T> <- internally use std::complex
complex<T, boost::array<T,2> > <- you guess ;)

I had similar concerns (supporting strangely allocated or aligned data
block) and I foudn this solution to be the easiest to put to work.

-- 
___________________________________________
Joel Falcou - Assistant Professor
PARALL Team - LRI - Universite Paris Sud XI
Tel : (+33)1 69 15 66 35

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