While C++11 standard says this about reinterpreting std::complex<double> as doubles:
For any pointer to an element of an array of
complex<T>namedpand any valid array indexi,reinterpret_cast<T*>(p)[2*i]is the real part of the complex numberp[i], andreinterpret_cast<T*>(p)[2*i + 1]is the imaginary part of the complex numberp[i]The intent of this requirement is to preserve binary compatibility between the C++ library complex number types and the C language complex number types (and arrays thereof), which have an identical object representation requirement.
Is it true for the backward reinterpreting? I mean is it safe to perform something like this: std::complex<double> *cppComplexArray = reinterpret_cast<std::complex<double> *>(cDoublesArray) where cDoublesArray have a type of double * and even length 2 * n? What are potential pitfalls if its length will be odd (2 * n + 1)?