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