On Sunday, 8 March 2020 at 17:58:16 UTC, Jesse Phillips wrote:
On Friday, 7 February 2020 at 19:37:08 UTC, mark wrote:
[snip]
I think I've usually used the associative arrays, but I also
think I tend to avoid using this approach but couldn't quite
remember what I do instead.
I believe I have started just using an array.
arr ~= addMyData;
arr.sort.uniq
Then I make use of the algorithms here.
https://dlang.org/phobos/std_algorithm_setops.html
I can see the sense in that for use with union & intersection.
However, AA's (assuming they are hashes under the hood) give O(1)
for `in` whereas those algorithms like the rbtree are O(lg n) for
`in`, and most of what I'm doing at the moment is `in`. I'll keep
the idea in mind though, because I have use cases for
intersection.