Tuesday, February 19, 2008

c++: template specification

When you define template class you can't definitely know what type it will wrap:

template<typename T>
class A;
You may use typeid but I don't like it at all. You should use general operations for T. But c++ allows you to define a template class for concrete type:
class A <int>;
Now you have class A for int type. This is rather useful if you can optimize template class for some concrete type.

No comments: