Which container to choose? (HashMap vs OwnedArray)


#1

Hi all,

I need to store objects (instances of a class) that have no point of living outside of the container (hence it would be cleaner if they could be autodestroyed when leaving the container), and that I can access quickly (not to say as fast as possible).

So far I was using the OwnedArray container, which is (really) great for its auto-locking and object life management features. Recently, I tried to use the HashMap on another type of objects, which is also great for quickly accessing an element of the container without iterating through all the content.

Here are my questions:
[list]
[]Does the HashMap implement an object life management like the OwnedArray? I looked in Juce’s source code but I found nothing related to that.[/]
[]Is the HashMap accessing method (through operator []) really faster than full iteration on a regular array?[/]
[]Should I start thinking about designing a class that would be an hybrid? (OwnedHashMap). Or is there something else in Juce’s container classes that I have missed in the documentation?[/][/list]