January 15, 2015 Re: auto return for some recursive functions in C++11 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad Attachments: | On Thu, 15 Jan 2015 00:24:07 +0000
via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Thursday, 15 January 2015 at 00:13:38 UTC, MattCoder wrote:
> > So could you please tell me a good use case to for using "return type deduction"?
>
> Templates.
and returning voldemort types.
| |||
January 15, 2015 Re: auto return for some recursive functions in C++11 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad | On Thursday, 15 January 2015 at 00:24:09 UTC, Ola Fosheim Grøstad wrote: > On Thursday, 15 January 2015 at 00:13:38 UTC, MattCoder wrote: >> So could you please tell me a good use case to for using "return >> type deduction"? > > Templates. Thanks! - In fact after posting I took a look and found this: http://stackoverflow.com/questions/15737223/when-should-i-use-c14-automatic-return-type-deduction Matheus. | |||
January 15, 2015 Re: auto return for some recursive functions in C++11 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Xinok | On Thursday, 15 January 2015 at 00:05:32 UTC, Xinok wrote: > I played with it a bit and it seems to deduce a common type from all the return statements, which would be more in the style of D anyways (take type deduction for arrays). Yes, this has changed some time ago, the specs are already updated: http://dlang.org/function.html#auto-functions Given that the compiler already uses the common type, maybe it should just disregard recursive uses during inference if there is more than one return. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply