template explicit specialization

Started by
3 comments, last by Basiror 18 years, 9 months ago
hi one little question about templates lets say i wrote a templated class template<class T> class someclass { .... }; and do a specilization for e.g.: integers template<> class someclass { ..... }; do i have to rewrite the code of each member function or only the functions i want to specialize for this datatype? thx
http://www.8ung.at/basiror/theironcross.html
Advertisement
You must rewrite the code =/
:( damn
http://www.8ung.at/basiror/theironcross.html
that’s not strictly true, you can just specialise a function if you want to in a single class and stil have the catch all function for other things


ie


template<class T>
class someclass
{

void foo(T input);
};


template<class T>
void someclass<T>::foo(T input)
{


}

template<>
void someclass<int>::foo(int input);


//in someclass.cpp

template<>
void someclass<int>::foo(int input)
{



}

[happy coding]
yeah thats what i were looking for

thx
http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement