Find in assoc array then iterate

Kevin Bailey keraba at yahoo.com
Sat Oct 22 04:53:09 UTC 2022


Hi Sergey,

While the unordered map doesn't guarantee an ordering (since its 
contents are
hashed), the order should remain static if you don't insert or 
delete.

Hi JG,

Thanks for the red-black tree reference. I'll read up on it in 
case I need it
but I'd prefer to use the built-in O(1) hash map.

Hi again Ali!,

I did consider a sort, but it has a number of downsides:
- it's O(n ln(n))
- if I'm understanding correctly, it would require additional 
memory
- Not relevant to my problem but, if you had duplicates, it 
wouldn't handle
stopping in the middle of some duplicates and re-starting; only 
iterators
support this.

One could more easily copy the keys into an array, and iterate on 
them.

Thus, I was hoping to find a member function that would support 
this.

Steven,

Just because you don't see the value doesn't mean I don't. You 
should try to
be more helpful, or don't bother.



More information about the Digitalmars-d-learn mailing list