Re: Help needed to learn typeof(return)

2022-03-27 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: Help needed to learn typeof(return)

2022-03-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/26/22 2:25 PM, Vinod K Chandran wrote: Hi all, I am reading `Programming in D` online book. There is a paragraph in the chapter `More Templates`. ``` typeof(return) generates the return type of a function, inside that function. For example, instead of defining the calculate() function

Re: Help needed to learn typeof(return)

2022-03-26 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 26 March 2022 at 18:25:54 UTC, Vinod K Chandran wrote: Hi all, The author says `LargerOf!(A, B)` is used instead of `auto` keyword. How did compiler understands the return type from `LargerOf!(A, B)`. Oh Sorry !. I forgot the `LargerOf!(A, B)` definition which is in the same

Help needed to learn typeof(return)

2022-03-26 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am reading `Programming in D` online book. There is a paragraph in the chapter `More Templates`. ``` typeof(return) generates the return type of a function, inside that function. For example, instead of defining the calculate() function above as an auto function, we can be more