Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<unsigned n>
- struct Arg {
- template<class X, class...Xs>
- constexpr auto operator()(X x, Xs...xs) {
- return Arg<n - 1>{}(xs...);
- }
- };
- template<>
- struct Arg<0> {
- template<class X, class...Xs>
- constexpr auto operator()(X x, Xs...) {
- return x;
- }
- };
- template<unsigned n>
- constexpr auto arg = Arg<n>{};
- // arg<2>(0, 1, 2, 3, 4, 5) == 2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement