Use of templates to avoid redudancy of code

Robert Fraser fraserofthenight at gmail.com
Wed Jun 4 00:26:31 PDT 2008


Mael wrote:
> okay thanks for the explanations,
> the D language never specifies whether a function or template argument is inlined or not ?
> It's left up to the compiler to choose what to do ?

Template arguments are always inlined. (since the template is generated 
by the compiler). There's a way to specify a function should NOT be 
inlined (use a .di w/o the function body and link in the final code), 
but there's little reason you'd want to do that if you had access to the 
code. I don't think DMD inlines any functions which accept delegate 
parameters, but I may be wrong (and I think in another thread someone 
showed GDC does).


More information about the Digitalmars-d-learn mailing list