[phobos] Proposal of StopWatch module

Andrei Alexandrescu andrei at erdani.com
Fri Aug 20 12:06:06 PDT 2010


On 08/20/2010 02:00 PM, SHOO wrote:
> (2010/08/20 19:35), SHOO wrote:
>> I rewrote:
>> http://ideone.com/5IgYU
>> How about it?
>>
>> P.S. I used an immutable struct for the first time...
>
> Oops, I forgot AUTOSTART.
> http://ideone.com/GiVmf
> AutoStart.yes seems to be slightly redundant.
> How about making a special type AutoStart with typedef and a AUTOSTART
> with constant value(enum)?
> See also: Line415, Line469, Line474-487

About the general usefulness of

enum SomeOption { no, yes }

I suggest we ask the newsgroup. Phobos uses it a fair amount and I 
haven't heard complaints. I think the basic idiom is a net improvement 
over bool, but I agree that AutoStart.yes is a bit redundant. But then 
the solution would be to define a constant like AutoStart and then a 
constant like NoAutoStart. We're back to square one.

At any rate, please no all-caps constants :o).


Andrei


More information about the phobos mailing list