Skip to content

Instantly share code, notes, and snippets.

@xaxxon
Created February 12, 2016 07:01
Show Gist options
  • Save xaxxon/05caff3de2e4aeaa7c3a to your computer and use it in GitHub Desktop.
Save xaxxon/05caff3de2e4aeaa7c3a to your computer and use it in GitHub Desktop.
#include <iostream>
#include <tuple>
using namespace std;
template<class Tuple, class... Types>
struct Devoider;
template<class Tuple>
struct Devoider<Tuple> {
using tuple_type = Tuple;
};
template<class... TupleTypes, class Head, class... Tail>
struct Devoider<tuple<TupleTypes...>, Head, Tail...> : public Devoider<tuple<TupleTypes..., Head>, Tail...> {};
template<class... TupleTypes, class... Tail>
struct Devoider<tuple<TupleTypes...>, void, Tail...> : public Devoider<tuple<TupleTypes...>, Tail...> {};
int main() {
Devoider<tuple<>, int, int, void, const char*>::tuple_type t{1,2,"hello"};
cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment