|
From: | jalina |
Subject: | Re: Explicit instanciation of template function |
Date: | Wed, 28 Mar 2007 21:57:13 +0200 |
User-agent: | Thunderbird 1.5.0.10 (X11/20070307) |
Bernd Strieder a écrit :
Hello, jalina wrote:template<typename T> void my_swap(T& v1, T& v2)char i = 'a'; char j = 'b';my_swap(i, j); my_swap<int>(i, j); // <= /tmp/tmpl.cc|22| error: no matching function for call to ?my_swap(char&, char&)?There is no conversion from "char" to "int&". "char" to "char&" is possible, "char" to "const int&" is possible via a temporary, but my_swap needs "int&".Is it a known behavior ? bug in my compiler (gcc 4.1.2, ubuntu) ? ... ?No C++ compiler may accept it. Bernd Strieder
Thank you. I get the point. J.
[Prev in Thread] | Current Thread | [Next in Thread] |