Operator overhaul
Stewart Gordon
smjg_1998 at yahoo.com
Sat Nov 1 15:21:45 PDT 2008
"Denis Koroskin" <2korden at gmail.com> wrote in message
news:op.ujyj0qpio7cclz at proton.creatstudio.intranet...
<snip>
> I often use the following pattern:
>
> [code]
> auto possibleResults[3] = [
> Result1,
> Result2,
> Result3,
> ];
>
> int cmp = compare(a, b) + 1; // cmp is 0, 1 or 2
> return possibleResults[cmp];
> [/code]
So you rely on custom-made compare functions that always return -1, 0 or 1?
In this case, why not make them return 0, 1 or 2 in the first place?
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