Having a brain fart... Is it possible to make something like this work?
template struct Foo
{
template struct Bar;
};
template
As others have pointed out, C++ doesn't let you specialize a nested class if the outer class template is not also specialized. When I had a situation like that, I was able to work around it with a helper class tucked away in an internal namespace:
namespace internal {
template struct FooBarHelper
{ /* ... */ };
// Specialization
template struct FooBarHelper
{ /* specialized version goes here */ };
}
template struct Foo
{
template struct Bar : public internal::FooBarHelper;
};
Of course it's not quite as hidden as you might like it to be.