Last active
May 9, 2019 15:27
-
-
Save kurotych/e2947297555137f03ec5fce4d5bbc43e 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
#include <utility> | |
// C++14 | |
template <int i1, int i2, typename... Args> | |
auto to_pair(std::tuple<Args...> t) | |
{ | |
return std::make_pair(std::get<i1>(t), std::get<i2>(t)); | |
} | |
// C++11 | |
template <int i1, int i2, typename... Args> | |
auto to_pair(std::tuple<Args...> t) | |
-> decltype(std::make_pair(std::get<i1>(t),std::get<i2>(t))) | |
{ | |
return std::make_pair(std::get<i1>(t), std::get<i2>(t)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment