#pragma once #include "compat/integer-types.hpp" #include #include #include #include namespace floormat::detail::map { template CORRADE_ALWAYS_INLINE constexpr auto map0(const F& fun, const std::array& array, std::index_sequence) { return std::array { fun(array[Indexes])... }; } #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4996) #endif template [[deprecated("zero-length array!")]] CORRADE_ALWAYS_INLINE constexpr auto map0(const F&, const std::array&, std::index_sequence<>) { return std::array, const std::remove_cvref_t&>>, 0>{}; } #ifdef _MSC_VER #pragma warning(pop) #endif } // namespace floormat::detail::map namespace floormat { template F, size_t N> constexpr auto map(const F& fun, const std::array& array) { using return_type = std::decay_t; static_assert(!std::is_same_v); static_assert(std::is_same_v>); static_assert(sizeof(return_type) > 0); using ::floormat::detail::map::map0; return map0(fun, array, std::make_index_sequence{}); } } // namespace floormat