tuple: add query for nth parameter pack value

This commit is contained in:
Danny Robson 2018-01-23 17:25:43 +11:00
parent 82a8446e10
commit 007add45f2

View File

@ -208,6 +208,15 @@ namespace util::tuple {
struct index<T,std::tuple<U, Types...>> { struct index<T,std::tuple<U, Types...>> {
static constexpr std::size_t value = 1 + index<T, std::tuple<Types...>>::value; static constexpr std::size_t value = 1 + index<T, std::tuple<Types...>>::value;
}; };
///////////////////////////////////////////////////////////////////////////
template <std::size_t Idx, typename ...Args>
auto
nth (Args &&...args)
{
return std::get<Idx> (std::tuple {std::forward<Args> (args)...});
}
}; };