mercredi 2 janvier 2019

Multiple templated variadic templates

I would like to use two templated parameter packs but I do not know how to do it. I read a lot of other StackOverflow posts but not one with templated parameter pack.

template < template < unsigned int > class... EntityList >
struct Entities{};

template < template < unsigned int > class... EntityBuilderList >
struct EntityBuilders{};

template < unsigned int dim, template < unsigned int > class... T >
class CompleteBuilder;

template < unsigned int dim, template < unsigned int > class... EntityList, 
    template < unsigned int > class... EntityBuilderList >
class CompleteBuilder< dim, Entities< EntityList...>, EntityBuilders< EntityBuilderList...> >
    : public EntityBuilderList< dim >...
{};

Then, I would like to use it like CompleteBuilder< 3, Entities< A, B, C >, EntityBuilders< Ab, Bb, Cb > > builder. But I have this error:

error: type/value mismatch at argument 2 in template parameter list for ‘template<unsigned int dim, template<unsigned int <anonymous> > class ... T> class CompleteBuilder’
 class CompleteBuilder< dim, Entities< EntityList...>, EntityBuilders< EntityBuilderList...> >
                                                                                                            ^
note:   expected a class template, got ‘Entities<EntityList ...>’

Thanks for your help

Aucun commentaire:

Enregistrer un commentaire