#ifndef OPENMW_COMPONENTS_MISC_META_H #define OPENMW_COMPONENTS_MISC_META_H #include #include #include namespace Misc { template struct TupleHasType; template struct TupleHasType> { static constexpr bool value = (std::is_same_v || ...); }; template struct TupleTypeIndex; template struct TupleTypeIndex> { static constexpr std::size_t value = 0; }; template struct TupleTypeIndex> { static constexpr std::size_t value = 1 + TupleTypeIndex>::value; }; template void tupleForEach(TupleType& tuple, Callable&& f) { std::apply([&f](auto& ...x) {(f(x), ...); }, tuple); } } #endif