Re: std::complex standard packing requirements was Re: [eigen] FFT for Eigen

[ Thread Index | Date Index | More Archives ]

2009/5/19 Mark Borgerding <mark@xxxxxxxxxxxxxx>:
> I had this discussion a few years ago on comp.lang.c++ when I was trying to
> share complex buffers between  c99 libs and C++ apps.
> The bottom line is that the original  C++ ISO standard did not require
> array[2] packing for std::complex, but that requirement was in the standards
> pipeline and all sane compilers already do it.

Thanks a lot!

> It should be safe enough to go down that path, but it would still be good to
> add a compile time check to ensure
> sizeof( std::complex<T> ) ==  2*sizeof(T)
> and a runtime check for
> &cpx.imag()  -  &cpx.real() == 1

I'd rather see them in the unit-tests, as this kind of thing could end
up unneededly slowing compilation (for static asserts) and execution
(normal asserts).


Mail converted by MHonArc 2.6.19+