From 83f60aa9a5a2452158b7774044dcc51c82c43ae4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 24 May 2024 11:59:48 +0200 Subject: w --- compat/iota.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 compat/iota.hpp (limited to 'compat') diff --git a/compat/iota.hpp b/compat/iota.hpp new file mode 100644 index 00000000..91ad759c --- /dev/null +++ b/compat/iota.hpp @@ -0,0 +1,23 @@ +#pragma once +#include + +namespace floormat::detail { + +template +std::array constexpr iota_array_() +{ + static_assert( size_t(Type(Count)) == Count ); + std::array ret; + for (size_t i = 0; i < Count; i++) + ret[i] = Type(i); + return ret; +} + +} // namespace floormat::detail + +namespace floormat { + +template +constexpr inline std::array iota_array = detail::iota_array_(); + +} // namespace floormat -- cgit v1.2.3