【发布时间】:2023-08-13 10:42:01
【问题描述】:
我试图在另一个类中专门化一个模板类,但编译器不让我这样做。该代码在 Foo 类之外工作,但不在内部,我希望 struct Bla 对 Foo 类是私有的。
class Foo {
template<typename ... Ts> struct Bla;
template<> struct Bla<> { static constexpr int x = 1; };
};
error: explicit specialization in non-namespace scope 'class Foo'
【问题讨论】:
标签: c++ templates template-specialization