I have a simple typelist implementation;
template<typename... Ts>
struct Typelist
{
static constexpr size_t count{sizeof...(Ts)};
};
What I want to do with it, is for generate an std::tuple of std::vector> for every type in the typelist; for example:
struct A {};
struct B {};
struct C {};
using myStructs = typelist<A,B,C>;
using myList = tupleOfVectorTypes<myStructs>; tuple<vector<A>, vector<B>, vector<C>>
This is what I've been playing around with:
template<template<typename... Ts> class T>
struct List
{
using type = std::tuple<std::vector<Ts>...>;
};
However, it keeps spitting back that it expects a type. I've tried wrapping Ts in decltype, like so:
using type = std::tuple<std::vector<decltype(Ts)>...>;
But that's wrong as well, and I'm guessing I'm using decltype incorrectly as well.
So, how can I create a tuple of vectors of types, based off the typelist I throw it?
The trick is to use specialization to drill down to the template parameters.
Tested with gcc 5.3.1 in
-std=c++1zmode: