Would it be possible (and useful) to introduce declarations like `auto foo() if(isInputRange(auto));

Roman D. Boiko rb at d-coding.com
Thu May 17 14:29:53 PDT 2012


On Thursday, 17 May 2012 at 21:09:10 UTC, Jonathan M Davis wrote:
> It would still be necessary, because the compiler needs to know 
> what the
> actual return type is. Knowing that the type implements 
> popFront, front, and
> empty isn't enough. It needs to know the actual, physical 
> layout of the type
> to generate the proper code. And when dealing with an 
> interface, the return
> type must be covariant, and unless the types are both classes 
> and one is
> derived from the other (directly or indirectly), they won't be 
> covariant even
> if they have all of the same functions.
>
> - Jonathan M Davis
I felt there is some fundamental problem, otherwise it would have 
been implemented already. But couldn't find any myself. Thanks!


More information about the Digitalmars-d mailing list