Metaprogramming in D tonight at the NWCPP

Daniel Keep daniel.keep.lists at gmail.com
Mon Apr 27 06:07:33 PDT 2009



Arild Boes wrote:
> Here’s the link:
> 
> http://www.vimeo.com/4333802
> 

One thing that I thought could have been explained was that this:

> T increment(T)(T x)
> {
>     return x + 1;
> }
>
> auto j = increment(3);

Is actually this:

> template increment(T)
> {
>     T increment(T x)
>     {
>         return x + 1;
>     }
> }
>
> auto j = increment!(typeof(3)).increment(3);

That explains how the template member promotion works AND explains why
the return type of template functions can use the template argument.

Still watching and enjoying it.  :)

  -- Daniel


More information about the Digitalmars-d-announce mailing list