Explicit instanciation of template function

2007-03-27 Thread jalina
I am learning C++ using gcc but I can not get the following to compile: #include #include using namespace std; template void my_swap(T& v1, T& v2) { cout << "swap - sizeof(T): " << sizeof(T) << "\n"; T tmp = v1; v1 = v2; v2 = tmp; } int main() { char i = 'a'; char j =

Re: Explicit instanciation of template function

2007-03-28 Thread jalina
Bernd Strieder a écrit : Hello, jalina wrote: template void my_swap(T& v1, T& v2) char i = 'a'; char j = 'b'; my_swap(i, j); my_swap(i, j); // <= /tmp/tmpl.cc|22| error: no matching function for call to ?my_swap(char&, char&)?