Skip to content

Instantly share code, notes, and snippets.

@RicherMans
Created June 3, 2015 06:19
Show Gist options
  • Select an option

  • Save RicherMans/0cb2c28c5d1098a1b5b4 to your computer and use it in GitHub Desktop.

Select an option

Save RicherMans/0cb2c28c5d1098a1b5b4 to your computer and use it in GitHub Desktop.
Variadic Templates
template <typename... Ts> class Tuple{};
template <typename T,typename... Ts> class Tuple<T, Ts...>:Tuple<Ts...>{
public:
Tuple(T t,Ts... args):Tuple<Ts...>(args...),curt(t){};
private:
T curt;
};
template <size_t k, typename T, typename... Ts>
class Holder<k, Tuple<T, Ts...>>{};
template <size_t k, typename T, typename... Ts>
class Holder<k, Tuple<T, Ts...>> {
typedef typename Holder<k - 1, Tuple<Ts...>>::type type;
};
template <typename T,typename... Ts > class Holder<0, Tuple<T, Ts...>> {
typedef T type;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment