Reputation: 14879
I was trying to test the templated code below but I am getting the following error:
error: ‘Foo’ is not a template
Is my code below correct? It looks the simplest template code I can possibly do!
template<typename D>
struct Ciccio{
};
template<typename S>
struct Foo< Ciccio<S> >{
};
int main(){
typedef Ciccio<int> test_type;
Foo<test_type> f;
return 1;
}
Upvotes: 1
Views: 51
Reputation: 227608
As it stands, Foo
looks like a partial template specialization. You need to provide a primary Foo
class template:
template<typename D>
struct Ciccio {};
// primary template
template<typename S>
struct Foo;
// partial specialization
template<typename S>
struct Foo< Ciccio<S> > {};
int main(){
typedef Ciccio<int> test_type;
Foo<test_type> f;
}
Upvotes: 3