Skip to content

Instantly share code, notes, and snippets.

@zaltoprofen
Created June 10, 2015 05:19
Show Gist options
  • Save zaltoprofen/0d0ba37376d68a0cd8c9 to your computer and use it in GitHub Desktop.
Save zaltoprofen/0d0ba37376d68a0cd8c9 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <utility>
#include <tuple>
#include <typeinfo>
template<typename, template<typename...>class>
struct repack {
};
template<template<typename...> class Source, template<typename...> class Dest, typename ...Ts>
struct repack<Source<Ts...>, Dest> {
using type = Dest<Ts...>;
};
int main(int argc, char const* argv[])
{
using x = std::pair<int, double>;
using y = repack<x, std::tuple>::type;
y z;
std::cout << typeid(z).name() << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment