#pragma once

#include <type_traits>
#include <utility>

namespace util {

template<typename Fn, size_t... Ints>
auto for_constexpr(Fn&& func, std::index_sequence<Ints...>)
{
    if constexpr(std::is_void_v<std::invoke_result_t<Fn, std::integral_constant<size_t, 0>>>) {
        (func(std::integral_constant<size_t, Ints>{}), ...);
    }
    else {
        if((func(std::integral_constant<size_t, Ints>{}) && ...))
            return true;
        return false;
    }
}

} // namespace util
