ste*_*km3 1 c++
我有一个 map<int,map<int,string>> themap
map<int,map<int,string>> themap
我想交换元素themap [1]和themap [2]。但是内部地图map<int,string>很大,所以我不想复制它们。有没有办法做到这一点,或者我必须更改地图以使用指针。
map<int,string>
Ale*_*exD 5
您可以尝试std::map::swap外部地图:
std::map::swap
void swap( map& other ); 与其他容器交换内容。不对单个元素调用任何移动,复制或交换操作。
void swap( map& other );
与其他容器交换内容。不对单个元素调用任何移动,复制或交换操作。
归档时间:
9 年,10 月 前
查看次数:
363 次
最近记录: