Use of templates to avoid redudancy of code

Fawzi Mohamed fmohamed at
Tue Jun 3 06:53:49 PDT 2008

On 2008-06-03 15:19:33 +0200, Fawzi Mohamed <fmohamed at> said:

> On 2008-06-03 11:39:24 +0200, Mael <mael.primet at> said:
>> Hello,
>> I'm writing an algorithm that has, say, too possible behaviour 
>> depending on a switch. Since there are many imbricated loops, and the 
>> behaviour change is inside the loop, testing for the flag is 
>> time-consuming
> I trust you really profiled the code to see this (never optimize before 
> testing)

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

More information about the Digitalmars-d-learn mailing list