Multiple template template paremeters for template class

Viewed 70

Is it possible to pass two template classes into a template class?

I am looking to create a class that holds two different std::tuple<std::vector<>>.

I am beginning to suspect that what I want to achieve can not be done, but I can not find anything that says otherwise.

Below is the code I am working with:

#include <iostream>
#include <vector>
#include <tuple>

template<typename... Ts>
struct Typelist
{
  static constexpr std::size_t size { sizeof...(Ts) };   
};

template<class, class> class World;

template<template<typename... Arg1> class T1, template<typename... Arg2> class T2>
class World<Typelist, Typelist>
{

private:
  std::tuple<std::vector<T1>...> m1;
  std::tuple<std::vector<T2>...> m2;
};


int main() {
    // your code goes here
    using TL1 = Typelist<int, char, double>;
    using TL2 = Typelist<float, unsigned int, bool>;

    World<TL1, TL2> w2;
    return 0;
}

Live Example

Is this possible, and if so, what am I doing wrong? If not, is there a possible alternative?

1 Answers
Related