我想使用两个模板化的参数包,但我不知道该怎么做。我读了很多其他StackOverflow帖子,但没有阅读带有模板化参数包的帖子。
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 >...
{};
然后,我想像CompleteBuilder< 3, Entities< A, B, C >, EntityBuilders< Ab, Bb, Cb > > builder
一样使用它。但是我有这个错误:
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 ...>’
感谢您的帮助
答案 0 :(得分:0)
根据您对CompleteBuilder
的专业知识;您的主要模板需要这样定义
template <unsigned int dim, class... T>
class CompleteBuilder;