I have the need to treat a std::array<float>, which is of even length N, as if it was a std::array<complex> of length N / 2. If it was a bare array, I could just type-cast it like this:
Is there ANY way to accomplish this with std::array? As of yet, the only way I can see is to make a new array and copy the elements over to it. But this is a common trick when implementing fast Fourier transforms, and the code base uses std::array prolifically.Code:float real[N]; complex *pComplex = reinterpret_cast<complex *>(real);



LinkBack URL
About LinkBacks



