[phobos] Proposal of StopWatch module

Jonathan M Davis jmdavisprog at gmail.com
Tue Aug 17 22:24:51 PDT 2010


A suggestion for an enhancement would be to have a separate struct which uses 
RAII to start and stop the stop watch with that struct taking a 
delegate/function pointer that runs when the stop watch stops. That way, you get 
properly matched stops automatically, and you can just get it to automatically 
do whatever it is you want it to do when it's done - like print out the time 
elapsed. The result is that you can turn the whole usage of the stop watch into 
a single line of code. I've done similar stuff with stop watch code that I've 
written in the past, and I found it to be extremely useful.

- Jonathan M Davis


More information about the phobos mailing list