#pragma once #include #include #include #include #include #include namespace AMDiS { namespace Tools { namespace Impl_ { template constexpr decltype(auto) apply_impl(Functor&& f, Tuple&& t, std::index_sequence) { using std::get; return f(get(FWD(t))...); } template constexpr decltype(auto) apply_indices_impl(Functor&& f, index_t, std::index_sequence) { return f(index_t{}...); } } // namespace Impl_ template constexpr decltype(auto) apply(F&& f, Tuple&& t) { return Impl_::apply_impl(FWD(f), FWD(t), std::make_index_sequence>{}); } template constexpr decltype(auto) apply_variadic(Functor&& f, Args&&... args) { return apply(FWD(f), std::forward_as_tuple(args...)); } template constexpr decltype(auto) apply_indices(Functor&& f) { return Impl_::apply_indices_impl(FWD(f), index_t<0>{}, std::make_index_sequence{}); } template constexpr decltype(auto) apply_indices(Functor&& f, index_t) { return Impl_::apply_indices_impl(FWD(f), index_t<0>{}, std::make_index_sequence{}); } template constexpr decltype(auto) apply_indices(Functor&& f, index_t, index_t) { return Impl_::apply_indices_impl(FWD(f), index_t{}, std::make_index_sequence{}); } } } // end namespace AMDiS