I have already tried searching for this but haven't found anything.
I am learning about STL containers, and understand the pros and cons of sequential and associative containers, however am not sure why anyone would prefer an unordered container over an associative one, as surely it would not affect element insertion, lookup and removal.
Is it purely a performance thing, i.e it would take more processing to insert / remove to an associative container as it has to go through sorting? I don't know too much about the system side of things but in my head I feel like an unordered container would require more 'upkeep' than one that is automatically organised.
If anyone could shed some light it would be really appreciated.
std::map
andstd::unordered_map
are both associative arrays. Whereasstd::set
andstd::unordered_set
are not. – Borgesstd::set
and variants. But it also includes the unordered variants, so your terminology is still confusing. – Borges