I was reading book “template compelte guide” , I section : 12.2.1 Signatures I couldn’t understand a sentence of author :
Its return type, if the function is generated from a function template
what does the author means by “function generated by function template” ? , is he talking about template-id here? if so, why does return type matters in the case, since signature is defined by us?
A trivial example will be helpful, thanks.
In section 12.2.1 the authors describe under which situations declarations of functions can coexist. The declaration of function templates can coexist even if they have a different return type, e.g., you can declare:
If you make these functions non-templates, you can’t even declare them. Of course, in the form above you won’t be able to call the function although you may be able to explicitly the select one of the functions using a cast (I’m not sure about this).
The primary use of having functions with different return types coexist (although this wasn’t the original intent), is to remove some of these functions from the overload set based on condition, e.g.: