#pragma once #include #include #include /** \brief Produces std::array of specified size, containing copies of provided object. * Copy is performed N-1 times, and the last element is being moved. * This helper allows to initialize std::array in place. */ namespace ext { namespace detail { template constexpr auto make_array_n_impl(T && value, std::index_sequence) { /// Comma is used to make N-1 copies of value return std::array, size>{ (static_cast(indexes), value)..., std::forward(value) }; } } template constexpr auto make_array_n(std::integral_constant, T &&) { return std::array, 0>{}; } template constexpr auto make_array_n(std::integral_constant, T && value) { return detail::make_array_n_impl(std::forward(value), std::make_index_sequence{}); } template constexpr auto make_array_n(T && value) { return make_array_n(std::integral_constant{}, std::forward(value)); } }