handful and interval
ixid
nuaccount at gmail.com
Mon Sep 3 08:11:09 PDT 2012
>if (a in handful("struct", "class", "union"))
>
>How is this different from
>
>if(canFind(["struct", "class", "union"], a) {...}
It's a lot cleaner without the mess of brackets. You missed a )
on the second one, which, without intending snarkiness, perhaps
demonstrates the greater elegance of the former? Though being
able to use in on a simple array would be very nice.
if(a in ["struct", "class", "union"])
Wouldn't you expect to search an array at O(n) while an
associative array would be O(1), making the difference not
unintuitive?
More information about the Digitalmars-d
mailing list