[phobos] Proposal of StopWatch module
SHOO
zan77137 at nifty.com
Wed Aug 18 04:44:36 PDT 2010
(2010/08/18 14:24), Jonathan M Davis wrote:
> 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
It's nice.
I try to make some helper struct and functions that are given RAII, but
my trial prevented by dmd's bugs, eg. bug 3516.
I want to make it reservation temporarily.
More information about the phobos
mailing list