FFTW手册说明,它的fftw_complex
类型与STL中的std::complex<double>
类是位兼容的。但这对我来说并不起作用:
#include <complex>
#include <fftw3.h>
int main()
{
std::complex<double> x(1,0);
fftw_complex fx;
fx = reinterpret_cast<fftw_complex>(x);
}
这个给我报错:
error: invalid cast from type ‘std::complex<double>’ to type ‘double [2]’
我做错了什么?