On Thursday, 8 September 2016 at 13:28:15 UTC, Steven
Schveighoffer wrote:
Right, but there is a problem here. The connection of the
simple return type to the simple template parameter is not
necessarily guaranteed. That is, there is no guarantee
simple!int is going to return int (for any template).
This means the compiler has to determine how to make simple
return an int, and this isn't always obvious, or easy to
determine.
I don't know how compiler works, but my logic was:
- I have T simple(T) { ... }
- return type == template argument
- int ... = simple() => T == int => simple!int
I undestand that if it was:
auto simple(T) { ... } it should be difficult
Probably I'm missing someting about compiler internal structure,
not my field.
Andrea