Created
July 24, 2014 16:42
-
-
Save mattbierner/a3fc9b33f890134efa12 to your computer and use it in GitHub Desktop.
Index sequnece example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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