Use of templates to avoid redudancy of code

janderson askme at me.com
Wed Jun 4 00:26:54 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 is likely to inline.  Even if it doesn't it will be one less 
pointer indirection then a delegate.  Basically imagine as a copy past 
operation.  That's the easiest thing for the compiler to do, copy in 
your arguments.

The reason it may decide not to is due to template code reuse and yes 
that could be implementation specific.

-Joel


More information about the Digitalmars-d-learn mailing list