Default template arguments

bearophile bearophileHUGS at lycos.com
Mon Nov 19 07:47:33 PST 2012


Joseph Rushton Wakeling:

> Suppose I have a template, for which I provide a default 
> parameter type.  Is there any way of ensuring that this default 
> will be respected unless the user explicitly requests an 
> alternative type?

Take a look at how Complex does it:
https://github.com/D-Programming-Language/phobos/blob/master/std/complex.d

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list