Operator overhaul

Stewart Gordon smjg_1998 at yahoo.com
Sat Nov 1 13:42:30 PDT 2008


"Christopher Wright" <dhasenan at gmail.com> wrote in message 
news:gei556$1sgc$3 at digitalmars.com...
<snip>
> I can never remember how the values for comparison work. An enum somewhere 
> (except that's a new type, so just constants):
>
> struct Comparison
> {
> const int LeftIsGreater = -1;
> const int Equal = 0;
> const int RightIsGreater = 1;
> }
>
> That's simple, it doesn't require any compiler changes, and it'll save me 
> some headaches.

Enums are implicitly convertible to their underlying types, so there's no 
point in using a struct instead.

If you're taking advantage of the ability to return an arbitrary int for 
performance, are you planning to multiply by one of these constants?

Stewart.

-- 
My e-mail address is valid but not my primary mailbox.  Please keep replies 
on the 'group where everybody may benefit. 




More information about the Digitalmars-d mailing list