Если это не появилось в профилировщике как узкое место, возможно, вы преждевременно оптимизируете.
Мой компилятор std::map::swap()
имеет следующий комментарий, который указывает, что своп карты, вероятно, будет очень быстрым:
/**
* This exchanges the elements between two maps in constant
* time. (It is only swapping a pointer, an integer, and an
* instance of the @c Compare type (which itself is often
* stateless and empty), so it should be quite fast.) Note
* that the global std::swap() function is specialized such
* that std::swap(m1,m2) will feed to this function.
*/
(g++ 4.4.5
)