On Friday, 21 October 2022 at 22:03:53 UTC, Kevin Bailey wrote:
I'm trying to do this equivalent C++:

    unordered_map<string, int> map;

    for (auto i = map.find(something); i != map.end(); ++i)
        ...do something with i...

in D, but obviously with an associative array. It seems that it's quite easy to iterate through the whole "map", but not start from the middle.
Am I missing something obvious (or not so obvious) ?

You can build a map using a red black tree.
Then you should be able to do what you want.

https://dlang.org/phobos/std_container_rbtree.html


Reply via email to