I have a script in which there is a template class
template<typename X, typename Y> class Foo { typedef Y::NestedType Bar; int A (Bar thing); void B(); int C(X that);
and then I would like method A () to have a different behavior when X is a given type (but B and C can remain unchanged, and the actual code actually has about 10 other methods, some of which are quite lengthy and subject to frequent tweaks. Therefore, I would prefer not to do full-fledged specialization and copy and paste the full implementation of the class)
I continued and wrote:
template<typename T> int Foo<MyType, T>::A(Bar thing);
but my compiler (clang 163.7.1) refused to even consider this as a specialized specialization.
Is there some kind of syntax error hidden in the way I wrote the code, or is this coding style invalid from C ++? Unfortunately, even if other compilers support the idiom, my company is stuck with clang.
Thanks for any help with this.
Enrico granata
source share