I am unable to decide which STL container to use in the following case:
Is there any readymade container available for this? I don't want to use a vector and then perform a std::find
before doing a push_back
every time.
Boost MultiIndex
should be able to do exactly what you want - you can just use one sequenced index to get the "ordered by insertion order" requirement, and either a hashed_unique
or ordered_unique
index to get the uniqueness requirement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With