这是简化的问题。
template <class T>
std::string name(const T&); // This is the template
// I want to explicitly specialize.
class Outer
{
class Inner
{
};
class Container : public ::Container<Inner> // This causes also an implicit
// specialization of f::name
{
};
};
我怎样才能专精
template <class T>
std::string name(const T&);
为Outer::Inner
?
我不能在我考虑的三个地方声明明确的专业化:
template <class T>
std::string name(const T&);
// 1. Here I cannot forward declare a nested class
class Outer
{
class Inner
{
};
// 2. Here I get error: explicit specialization
// in non-namespace scope 'class Outer'
class Container : public ::Container<Inner>
{
};
};
// 3. Here I get error: specialization of '...' after instantiation
我怎么解决这个问题?