Merging two std::map objects
Supposing I have two std::map<X,Y> objects A and B. I want to create another one, C, which would contain all the elements contained in A and B, what is the simplest way to do this? Alternatively, is there a direct way to copy the elements from B into A?
std::map<Foo,Bar> a;std::map<Foo,Bar> b;std::map<Foo,Bar> c;c.insert(a.begin(), a.end());c.insert(b.begin(), b.end());
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement