On Friday, 25 October 2019 at 05:17:35 UTC, Ali Çehreli wrote:
- Big O is different

No it isn't. Worst case lookup of an associative array lookup is O(n) too. It can easily be 'achieved' by having a key type with:
```
size_t toHash() const scope pure {
    return 0;
}
```

The fact that std.container specifies a worst-case time complexity for operations on its data structures doesn't mean every other type has to comply to those too. I can overload the 'in' operator on my types to something that takes exponential time if I want, just like "+" can also be overloaded to a linear time operation on e.g. BigInt.

- One wants to use keys for associative arrays but (likely) values for arrays

Then we implement `in` to look for values in arrays, just like users would expect.

Reply via email to