The FFTW manual says that its fftw_complex type is bit compatible to std::complex class in STL. But that doesn\'t work for me:
reinterpret_cast only works for pointers and references. So you'd have to do this:
#include
#include
int main()
{
std::complex x(1,0);
fftw_complex fx(*reinterpret_cast(&x));
}
This assumes that fftw_complex has a copy constructor. To avoid problems with strict aliasing, Goz's solution should be preferred.