Hi,
i do have a problem of understanding, but may be NOT I.
I do refer to
http://www.cplusplus.com/reference/algorithm/swap/
code snippet:
template <class T> void swap ( T& a, T& b )
{
T c(a); a=b; b=c;
}
This sample in variants can I find via google,
as "the example" for introducing Templates.
As i am a re-beginner,
"i am in the mood"
to see the first instruction : T c(a)
(which is already new for me - and i interprete, better guess, this as :
T C; c=a
- in 2 separated commands declaration of c followed by the assignment of a to c )
+++++
But for my problem i think "c" should be a Pointer type variable
" T * c; "
followed by c=a; and so on...
because the submitted parameters are "adresses, more specifically references"
So:
Am i correct, that the example of the template includes some implicit type casting ?
IF,
in general: I am looking for some documentation especially on implicit type casting regarding the usage of pointers, references and values in any direction.
OR: Am I completely on wrong way ?
----------------------------------
Thank you in advance.