Skip to content

Instantly share code, notes, and snippets.

@mattbierner
Created July 24, 2014 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbierner/a3fc9b33f890134efa12 to your computer and use it in GitHub Desktop.
Save mattbierner/a3fc9b33f890134efa12 to your computer and use it in GitHub Desktop.
Index sequnece example
// Example only shows expansion logic, not perfect forwarding
template<class F, class T, size_t... I>
auto unpack(F f, T t, std::index_sequence<I...>) {
return f(std::get<I>(t)...);
}
template<class F, class T>
auto tuple_eval(F f, T arg) {
return unpack(f, args, std::make_index_sequence<std::tuple_size<T>::value>());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment