Using templates in c++