Suggestion: Operator `in` for slices
Adam Ruppe
destructionator at gmail.com
Sat Dec 18 18:47:33 UTC 2021
On Saturday, 18 December 2021 at 18:29:56 UTC, Quirin Schroll
wrote:
> I guess it has never been implemented because this information
> (true/false) is so much less than it could be.
Nah, the general rule against it is due to speed/computational
complexity. The `in` operator on AAs has a speed of O(log n) or
O(1). `in` on slices would exceed that being O(n).
I'm not sure the speed rule is written or not, but generally `in`
is supposed to have the same speed requirement as `[n]` which is
sub-linear.
More information about the Digitalmars-d
mailing list