I cannot get this to compile at all. Perhaps I cannot, but I do not know why this should not be.
class A {
template <typename T>
class B {
int test() { return 0; }
};
B<int> myB_;
};
template <> class A::B<int> {
int test() {
return 1;
}
};
The compiler appears to be complaining: "The explicit specialization" class A :: B "must be declared before using it." If I try to provide a froward declaration in the comments, the compiler complains "Explicit specialization" B "must be declared in the namespace containing the template." Here we use 2 different compilers. This error is related to the IBM "xl" compiler on AIX, but when compiling on our Sun systems, similar errors occur with different options. Sounds like a trick-22.
, , , .
, . .
- ?