I will repost my answer to a similar question. I think this will do what you want.
Use a library like Boost.MultiIndex to do what you want. It scales well and there is a lot less boiler plate code if you want to add new indexes. It is also usually more space and time efficient
typedef multi_index_container< Container, indexed_by< sequenced<>, //gives you a list like interface ordered_unique<Container, std::string, &Container::a_value>, //gives you a lookup by name like map ordered_unique<Container, std::string, &Container::b_value> //gives you a lookup by name like map>> container;
If you are iterating over one index, you can switch to another index by using the iterator projection concept in the library.