Boost logo

Boost :

From: rwgk (rwgk_at_[hidden])
Date: 2001-12-21 17:51:23


> 2) subviews with other value_type
> Apparantly, when creating a sub-view, the value_type is
automatically
> the same as the value_type of the original matrix. Is it possible to
> take e.g. a double-view on a complex matrix ?

Is there a type-safe, portable way of obtaining a double* view of an
individual std::complex<double>?

Would this work?

std::complex<double> c;
double* a = &c.real();

Related question: does the ISO standard provide a guarantee for the
storage order of c.real() and c.imag()?

It seems to me that multi_array_ref could be the answer to the
original question, e.g.:

std::complex<double> v[10];
multi_array_ref(&(v[0].real()), ...)

Ralf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk