0
C++ template specialization
Hello everyone! Is it possible to use template specialization for ALL functions in a class? If yes, can you give an example please?
2 odpowiedzi
+ 2
Yeah you can specialize the class itself.
template<typename T>
class Foo {
void speak () { cout << "Hello from Foo<T>"; }
}
template<>
class Foo<int>{
void speak () { cout << "Hello from Foo<int>; }
}
0
Thanks