tuple: add index parameter helper for parameter packs

This commit is contained in:
Danny Robson 2018-03-15 15:20:21 +11:00
parent 7ce2f5454d
commit cbe439b8e9

View File

@ -204,6 +204,18 @@ namespace util::tuple {
};
///////////////////////////////////////////////////////////////////////////
template <size_t IndexV, typename HeadT, typename ...TailT>
auto
get (HeadT &&head, TailT &&...tail)
{
if constexpr (IndexV == 0)
return std::forward<HeadT> (head);
else
return get<IndexV-1> (std::forward<TailT> (tail)...);
}
///////////////////////////////////////////////////////////////////////////
template <std::size_t Idx, typename ...Args>
auto