how can i pass template class which take parameter pack to other template class as a parameter?

I have something like that:

template<int ... args>
class X{};

and want to pass that class as parameters to 2nd template class. Now I have:

template<class X<int... args1> el1, class X<int... args2> el2>
class Y{};

Compiler is throwing errors Pack expansion does not contain any unexpanded parameter packsto me and i don't really know what can i do...I have tried lot of possible order of int ... and args, but it is still not working. How may i make it work?

I want to make such piece of code compiling

Y<X<1,2>,X<3,4>> el;

Upvotes: 0

Views: 72

Answers (1)

cigien
cigien

Reputation: 60238

You appear to be looking for template template parameters, which have the following syntax:

template<template <int... args1> typename el1, 
         template <int... args2> typename el2>
class Y{};

Note that pre-c++17, you have to use the keyword class instead of typename here.

Upvotes: 2

Related Questions