6#ifndef VIR_SIMD_IOTA_H_
7#define VIR_SIMD_IOTA_H_
12#if VIR_HAVE_SIMD_CONCEPTS
13#define VIR_HAVE_SIMD_IOTA 1
20 template <
typename T,
typename>
23 template <
typename T, std::size_t... Is>
24 struct iota_array<T, std::index_sequence<Is...>>
25 {
static constexpr T data[
sizeof...(Is)] = {
static_cast<T
>(Is)...}; };
33 requires(std::is_arithmetic_v<T>)
37 template <vir::any_simd T>
38 inline VIR_SIMD_CONSTEXPR_SIMD T
39 iota_v<T> = T([](
int i) {
return static_cast<typename T::value_type
>(i); });
41 template <
typename T, std::
size_t N>
42 inline constexpr std::array<T, N>
43 iota_v<std::array<T, N>> = []<std::size_t... Is>(std::index_sequence<Is...>) {
44 return std::array<T, N>{
static_cast<T
>(Is)...};
45 }(std::make_index_sequence<N>());
47 template <
typename T, std::
size_t N>
48 inline constexpr auto&
49 iota_v<T[N]> = detail::iota_array<T, decltype(std::make_index_sequence<N>())>::data;
This namespace collects libraries and tools authored by Matthias Kretz.
Definition constexpr_wrapper.h:21
C++20 concepts extending the Parallelism TS 2 (which is limited to C++17).