I do the following.
template <class C> class B{};
template <class X>
struct A{
int member;
};
template <class Y>
struct A<B<Y>>{
A(int n):member(n){}
};
int main(int, char**){}
I.e. class X may be template itself and for that case I want to have specialisation of class A template.
But compiler says:
d:\>g++ -std=gnu++11 -o spec.exe spec.cpp
spec.cpp: In constructor 'A<B<Y> >::A(int)':
spec.cpp:11:14: error: class 'A<B<Y> >' does not have any field named 'member'
If class A<B<Y>>
is totlally separate from A
then all is correct and there may not be any members ofA
. But I want specialisation of A
. With all its content.
Or, may be, some specialized constructor for A
for case when X
is B<Y>
.
How to implement?