std::map 복사(std::copy)

Posted by [하늘이]
2018. 12. 5. 21:25 IT/C, C++
반응형



#include <map>


if( 0 < mapSource.size() )

{

    mapTarget.insert(mapSource.begin(), mapSource.end());

}


또는 


#include <map>

#include <algorithm>


if( 0 < mapSource.size() )

{

    std::copy(mapSource.begin(), mapSource.end(), std::inserter(mapTarget,mapTarget.begin()));

}



반응형