Use of templates to avoid redudancy of code

Fawzi Mohamed fmohamed at
Tue Jun 3 22:24:10 PDT 2008

On 2008-06-03 20:17:16 +0200, Mael <mael.primet at> said:

>> In case the issue is actually cleaning up the code, I would consider
>> making the action a delegate that you pass in to your algorithm (and
>> execute there).
> This doesn't incur a penalty on the execution time ? Does it unfold the 
> delegate as an inline function, or will there be calls to the delegate ?

yes this incurs a penalty if the delegate doesn't get inlined, and even 
if it does there might still be some small penalty.
So I said *if* you just need to clean up the code, then that is 
probably the best solution.

More information about the Digitalmars-d-learn mailing list