I'm trying to pin down the kind of container I need to select, and if there isn't one that works, to determine what I need to write my own that isn't too slow. Here are the requirements :
- Associative. I need it to work like a std::map in the way it can be used to return some value object based on a unique key object ( keys are unique in this scenario ).
- Unordered. I don't want the container ordering my pairs based on their keys.
- end() deletion, begin() insertion. I need to effectively be able to push() onto the end and pop() from the beginning - hence the unordered criterion above.
I came across unordered_map from C++11, but it's still ordering the objects by key, even when I provide a hint, unless I'm doing it wrong :
When I iterate from begin() to end(), my output is
unordered_map <int, int> umap;
umap.insert(pair <int, int> (1, 123));
umap.insert(pair <int, int> (3, 345));
umap.insert(pair <int, int> (2, 234));
I've also used
as a hint, to no avail.
umap.insert(umap.end(), pair <int, int> (1, 123));
Any suggestions would be hugely appreciated. Thank you !