Partial template function specialization

Simen Kjaeraas simen.kjaras at gmail.com
Thu Aug 20 00:13:21 PDT 2009


Peter Alexander wrote:

> Hey all,
>
> I'm considering learning D at the moment, and one thing that has  
> bothered me in C++ is the lack of partial template function  
> specializations.

T foo( T, U )( U value ) {...}

template fooPartial( T ) {
   alias foo!( T, int ) fooPartial;
}

This may or may not have been what you want.

> Also, while I'm here. Does D have any macro support? I know it doesn't  
> have pre-processor macros, but something like Nemerle's macros would be  
> really, really nice.

Macros are currently scheduled for D3. In the meantime, you can do just
about anything with string mixins and CTFE.

-- 
   Simen


More information about the Digitalmars-d-learn mailing list