Advertisement
frasl

Untitled

Feb 15th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. template<unsigned n>
  2. struct Get {
  3.  template<class X, class…Xs>
  4.  constexpr auto operator()(X x, Xs…xs) {
  5.    if constexpr(n > sizeof(xs) ) {
  6.      return;
  7.    } else if constexpr(n > 0) {
  8.      return Get<n-1>{}(xs…);
  9.    } else {
  10.      return x;
  11.    }
  12.  }
  13. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement