Boost logo

Boost Users :

From: Russell Hind (rhind_at_[hidden])
Date: 2004-02-18 04:10:44


Currently I'm doing more and more mathematical calculations on
containers, and wondered if there is any library out there that allows
containers to be placed in expressions without having to use
transform/for_each etc.

e.g.

std::vector<std::complex<double> > V1;
std::vector<std::complex<double> > V2;
double C1, C2;

...

std::vector<std::complex<double> > Result;

    Result = C1 + V2 / (V1 * C2);

while would be equivalent to (assuming Result has been resized)

(I'm currently using a mixture of transforms and spirit::phoenix
(because lambda doesn't work with my compiler))

transform(V1.begin(), V1.end(), V2.begin(),
           Result.begin(),
           C1 + phoenix::arg2 / (phoenix::arg1 * C2));

Or something to this effect that will aid with this.

Cheers

Russell


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