多个模板化可变参数模板
Multiple templated variadic templates
我想使用两个模板化参数包,但我不知道该怎么做。我阅读了很多其他 Whosebug 帖子,但没有阅读带有模板化参数包的帖子。
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 ...>’
感谢您的帮助
根据您的专业CompleteBuilder
;您的主模板需要这样定义
template <unsigned int dim, class... T>
class CompleteBuilder;
我想使用两个模板化参数包,但我不知道该怎么做。我阅读了很多其他 Whosebug 帖子,但没有阅读带有模板化参数包的帖子。
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 ...>’
感谢您的帮助
根据您的专业CompleteBuilder
;您的主模板需要这样定义
template <unsigned int dim, class... T>
class CompleteBuilder;