Help needed to learn typeof(return)
Vinod K Chandran
kcvinu82 at gmail.com
Sun Mar 27 13:22:26 UTC 2022
On Sunday, 27 March 2022 at 01:11:02 UTC, Steven Schveighoffer
wrote:
>
> Not sure what the question here is,
>
Thanks for the reply. Actually, my problem was this, I forgot the
presence of `LargerOf!(A, B)` template function in that chapter.
When I see it in a function, I thought where is the
implementation of this function ? But later I found it.
> And yes, you can get into paradoxical problems like:
>
> ```d
> auto foo()
> {
> typeof(return) x;
> return x;
> }
> ```
>
> which will not compile.
>
Yeah, I got the point. In fact, after reading the `Template`
chapter in that book, I am amazed. There are lot of possibilities
in D templates.
More information about the Digitalmars-d-learn
mailing list