Andreas Schwab wrote:
> Nick Roberts <nickrob snap.net.nz> writes:
>
>> Yes, thanks. It seems strange to me that the
return type needs to be
>> specified. I thought with overloading, people
talked about signature
>> which is determined by the name and arguments but
not the return type.
>
> For function templates the return type is part of the
signature (it can
> be parameterised with a template argument).
I'm not sure it's true. Consider:
template<class T>
T foo();
template<class T>
void bar();
The value of template parameter is indeed the part of
signature.
The return value does not seem to be, since it directly
depends
on template parameter, so:
foo<int>()
quite uniquely specify the type of return value.
- Volodya
|