Peter Alexander:

> 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.

I think that was partial specialization, but the name was indeed different. 
Templates once instantiated produce all different functions, so when you 
instantiate them you have the same gains coming from partial instantiation.

If you want a single name for both templates you can probably do that too, you 
may need a third template with a different type that a compile-time uses one or 
the other version of the template, in D2 you can also use template constraints.

If you show me your use case there's probably some way to solve your problem, I 
have found D templates quite flexible.


>Cool. Is there any sort of ETA on D3?<

It may be possible that some of my words have changed Walter's mind, so macros 
will not be seen in D.

Bye,
bearophile

Reply via email to