在map中插入map的值
作者:互联网
//在map中插入map的值:
#include <map>
#include <iostream>
int main() {
std::map<int, int>a,b,c;
a.insert({ 1,1 });
a.insert({ 2,2 });
//复制第一组
b.insert({ a.begin()->first,a.begin()->second});
std::cout<<b.begin()->first<<" "<< b.begin()->second;
//复制最后一组
std::map<int, int>::iterator it = a.end();
it--;
c.insert({ it->first,it->second });
std::cout << c.begin()->first << " " << c.begin()->second;
std::cout << "hello";
return 0;
}
标签:std,map,begin,insert,插入,second,first 来源: https://www.cnblogs.com/jessicaland/p/16607260.html