tuple: add index parameter helper for parameter packs
This commit is contained in:
parent
7ce2f5454d
commit
cbe439b8e9
12
tuple.hpp
12
tuple.hpp
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user