[OT] Re: Targeting C
Max Samukha
spambox at d-coding.com
Sat Oct 24 04:05:26 PDT 2009
On Fri, 23 Oct 2009 13:08:06 -0500, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
>
>I wanted to use auto, but ddoc cannot document functions with auto returns.
>
>Andrei
>
When I need to hack around an 'auto' bug, I sometimes factor out the
return type to a template:
template IotaRet(B, E, S = size_t)
{
alias Take!(Sequence!("a.field[0] + n * a.field[1]",
Tuple!(CommonType!(B, E), S))) IotaRet;
}
IotaRet!(B, E, S) iota(B, E, S)(B begin, E end, S step) {}
IotaRet!(B, E) iota(B, E)(B begin, E end) {}
>P.S. It looks like TDPL will scream today through the 100,000 words
>barrier (at 97,781 words now, see and track at www.erdani.com). When
>that happens, I'll celebrate by making another excerpt available online.
Congrats!
More information about the Digitalmars-d
mailing list