10USERVER_NAMESPACE_BEGIN
16template <std::size_t... Indices,
typename Func>
17void DoForEachIndex(std::index_sequence<Indices...>, Func func) {
18 static_assert(std::is_trivially_copyable_v<Func>);
19 (..., func(std::integral_constant<std::size_t, Indices>{}));
22template <std::size_t... Indices,
typename Func>
23void DoWithConstexprIndex(std::index_sequence<Indices...>, std::size_t runtime_index, Func func) {
24 static_assert(std::is_trivially_copyable_v<Func>);
25 (..., (runtime_index == Indices ? func(std::integral_constant<std::size_t, Indices>{}) :
void()));
32template <std::size_t Count,
typename Func>
34 impl::DoForEachIndex(std::make_index_sequence<Count>{}, func);
38template <std::size_t Count,
typename Func>
40 impl::DoWithConstexprIndex(std::make_index_sequence<Count>{}, runtime_index, func);