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

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to