In the call
auto m2 = max(s1,s2,s3);
T
is deduced to be char const *
. So max
must return char const * &
. The inner call to max(..., c)
returns a char const *
, so to return a reference to that, it must construct a reference to a temporary.