Bill Baxter wrote:
On Tue, Dec 1, 2009 at 12:23 PM, Bill Baxter <[email protected]> wrote:
On Tue, Dec 1, 2009 at 12:15 PM, Pelle M�nsson <[email protected]> wrote:
It's a bit difficult to see a very thin operator mask a linear operation,
but I'm thinking maybe "x in y" could be defined if y is a compile-time
array. In that case, the compiler knows the operation and the operand so it
may decide to change representation as it finds fit.
Andrei
What do you suggest using when you need to find out if an object is in an
array? Arrays lacking opIn bothers me.
I'm guessing Andrei would recommend std.range.find.
er... std.algorithm.find, I mean.
--bb
I find
if (x in [1, 2, 3]) { }
more clear than
if ([1, 2, 3].find(x).length != 0) { }