In expression for array
janderson
askme at me.com
Thu Jan 24 09:56:34 PST 2008
kede wrote:
> Hi All,
>
> How about adding In expressions for general arrays in addition to assoc arrays:
>
> if ('i' in eyes)
> ...
>
> as a simple replacement for the more verbose
> foreach(c; eyes)
> if (c == 'i')
> ...
>
> I think its a common enough pattern to warrant inclusion?
>
> Have fun,
> kede
I think something like:
if (contains(eyes, 'i'))
and
auto value = find(eyes, 'i');
should be in the standard library. It seems excessive to put 'in' in
the language.
-Joel
More information about the Digitalmars-d
mailing list