I see.I don't think you can avoid duplication of keys --if the keys are really expensive to duplicate, you might consider holding shared_ptrs to them, but this is AFAICS the furthest you can get.
Well, I guess you're right.Take into acount that a multi_index_container with two keys is not a map of maps. These are different beasts, serving different purposes, * a map of maps applies two concatenated lookups to get to a "terminal" object, * a multi-index container with two indices applies either one of two poosible lookups to get to the object, so you might want to ask yourself whether it makes sense to try to replace your current code with Boost.MultiIndex. What are the advantages / use cases you envision?