[Issue 1323] Implement opIn_r for arrays
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 9 11:18:08 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1323
------- Comment #3 from smjg at iname.com 2007-07-09 13:18 -------
(In reply to comment #2)
> Workarounds... (that dont work if key and value type are the same)
Only because you've chosen to give the functions the same names.
> bool contains(V, K)(V[K] array, K key)
> {
> foreach(k; array.keys) if (k == key) return true;
> return false;
> }
What's wrong with
return cast(bool) (k in array);
?
--
More information about the Digitalmars-d-bugs
mailing list