C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Complex type traits

From: Bjorn Reese <breese_at_[hidden]>
Date: Mon, 20 Nov 2023 15:26:26 +0100
On 11/20/23 03:34, Paul Caprioli via Std-Proposals wrote:

> Since a pointer to an element of an array of `std::complex<T>` can be reinterpreted as a pointer to `T` (with the real-valued array having twice as many elements), some codes use the former and others the latter. So, templated code in libraries and suchlike may want to work with either.
>
> My actual use case is FFTs, which can take real or complex arrays and real-valued scaling factors. The

Another use-case is to have an array of real values and another with
imaginary values, which is useful when using FFT for Cosine or Hartley
transforms.

Something like a complex_span<T, Layout> class would be more generic
that can be further extended for SIMD types.

Received on 2023-11-20 14:26:30