【发布时间】:2018-09-20 08:54:45
【问题描述】:
我正在尝试使用 CRTP,但我对为什么以下代码无法编译感到困惑。
template<template<class...> class CBase>
struct ComponentX : public CBase<ComponentX>
{
// This does NOT compile
};
template<template<class...> class CBase>
struct ComponentY : public CBase<int>
{
// This does compile
};
你知道在CRTP的情况下模板模板参数是否有限制吗?
【问题讨论】:
-
好问题。不过,
ComponentX定义之前的所有内容都与 MCVE 无关。 -
谢谢,是的,你完全正确。只是为了举例说明如何使用它(我忘了写最后一部分)。
标签: c++ templates template-meta-programming crtp