extend "in" to all array types
Jakob Ovrum
jakobovrum at gmail.com
Thu Jan 16 00:27:24 PST 2014
On Thursday, 16 January 2014 at 07:28:43 UTC, luka8088 wrote:
> On 15.1.2014. 16:30, pplantinga wrote:
>> In python, I really like the ability to check if an element is
>> in an array:
>>
>> if x in array:
>> # do something
>>
>> D has this, but only for associative arrays. Is there any
>> chance we
>> could extend this to every kind of array?
>
> D array uses this operator for checking against array keys, not
> values.
It makes sense for sorted arrays, as they make good sets.
That said, it makes the most sense to limit opBinaryRight!"in" to
SortedRange.
More information about the Digitalmars-d
mailing list