I need a container, where:
- when I add a new element that does not exist yet, it is added to the top of the list
- when I add an element that already exists, it is not added and I I get its index in the list
- once the element is inserted, it always has the same index and it can be accessed using this index
std::set alone is insufficient, because I cannot access the elements with [index]. std::list neither, because it does not store unique only elements.
I used a mixed solution with list and map but maybe there is some standard, generic template for that?
I don't want to use boost. Invoking list::unique after every insertion is no solution.