Created
May 31, 2017 15:02
-
-
Save njlr/691d9862fc7af5a02791e5dc3cdb2536 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<unsigned n> | |
struct Get { | |
template<class X, class…Xs> | |
constexpr auto operator()(X x, Xs…xs) { | |
if constexpr(n > sizeof…(xs) ) { | |
return; | |
} else if constexpr(n > 0) { | |
return Get<n-1>{}(xs…); | |
} else { | |
return x; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment