Partial template function specialization

Peter Alexander peter.alexander.au at gmail.com
Thu Aug 20 02:55:49 PDT 2009


Simen Kjaeraas Wrote:
> 
> T foo( T, U )( U value ) {...}
> 
> template fooPartial( T ) {
>    alias foo!( T, int ) fooPartial;
> }
> 
> This may or may not have been what you want.

Not quite sure what's going on there, but it doesn't look like what I want.

I want a general function:

T foo(T, U)(U value)

and one specialized for when U = Vector3!(T)

Also, it's important that the original and the specialization have the same function name, otherwise it's not really generic at all.


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

Cool. Is there any sort of ETA on D3?


More information about the Digitalmars-d-learn mailing list