How can I copy one map into another using std::copy?

You can use GMan’s answer — but the question is, why do you want to use std::copy? You should use the member function std::map<k, v>::insert instead.

m2.insert(m1.begin(), m1.end());

Leave a Comment