Last active
May 12, 2019 12:07
-
-
Save kim366/8b71bb21ca9a2919e95acc24cc57a89e to your computer and use it in GitHub Desktop.
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
| template<typename Op, typename Tuple, std::size_t... Is> | |
| void invoke(Op op, const Tuple& args, std::index_sequence<Is...>) | |
| { | |
| op(std::get<Is>(args)...); | |
| } | |
| template<typename Op, typename... Args> | |
| void invoke(Op op, const std::tuple<Args...>& args) | |
| { | |
| invoke(op, args, std::index_sequence_for<Args...>{}); | |
| } | |
| int main() | |
| { | |
| invoke(std::printf, std::make_tuple("%d, %f", 3, 6.1)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment