BobR wrote in message ...
>
>template <class T>
>T GetValue(T t) {  // <--note the parms
>    if (t == 1)    // <-- note the '==' compare, NOT '=' assignment.
>        return 1;
>    else
>        return 2.55;
>}

NOPE! That won't fix it!

template <class T>
T GetValue(T t) {
    if (t == 1)
        return 1;
    else
        return T(2.55);
    }

....compiled without warning.
output:

Int a : 1

Double b: 2.55

--
Bob R
POVrookie



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

Reply via email to