Skip to content

Instantly share code, notes, and snippets.

@buffyanamin
Created January 5, 2022 09:02
Show Gist options
  • Save buffyanamin/9e590ad58dad872989e786cffba66a6a to your computer and use it in GitHub Desktop.
Save buffyanamin/9e590ad58dad872989e786cffba66a6a to your computer and use it in GitHub Desktop.
Get nth element from c++ variadic template argument
template <int I, class... Ts>
decltype(auto) get(Ts&&... ts) {
return std::get<I>(std::forward_as_tuple(ts...));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment