STL的erase操作
来源:互联网 发布:pdf转换dwg软件 编辑:程序博客网 时间:2024/04/30 12:03
http://www.cplusplus.com/reference/stl/map/erase/
Erase elements
Removes from the map container either a single element or a range of elements ([first,last)).
This effectively reduces the container size by the number of elements removed, calling each element's destructor.
原话是这么说的,,可是经过实际测试:
#include "stdafx.h"
#include <map>
#include <list>
#include <iostream>
using namespace std;
class A
{
public:
A()
{
}
~A()
{
cout<<"Destructing"<<endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
map<int,A*> mapA;
A* pA1 = new A;
mapA.insert(make_pair(1,pA1));
mapA.erase(1);
list<A*> listA;
A* pA2 = new A;
listA.push_back(pA2);
listA.erase(listA.begin());
return 0;
}
发现析构函数并没有调用,看来cpp网站上的STL跟VC中的不是一个版本啊,要么就是我理解有误?
- STL的erase操作
- STL vector的erase操作问题
- STL vector的erase操作问题
- STL vector的erase操作问题
- STL vector的erase操作问题
- STL中map的erase操作
- STL vector的erase操作问题
- STL容器的遍历删除操作erase
- STL erase操作
- STL erase操作
- Stl的erase
- 关于STL中的erase操作
- STL中容器操作的迭代器失效-erase()函数陷阱
- stl erase 的正确使用
- STL容器的erase用法
- STL中容器的erase()
- 谨慎使用STL中的erase操作!
- STL vector等容器erase操作
- ORACLE几个常用的X$表
- 路
- 有关js parseInt("08")问题
- [DEBUG]内存泄露调试
- 快速排序算法相关
- STL的erase操作
- gc野马通过压力测试(只有1K单位的容量,gc作用明显)
- Android 编译命令及选项
- 关于N个鸡蛋M个篮子
- split方法和转义字符
- 无法删除 找不到指定路径
- 固定点的另外三种变形
- 下载oracle
- 我对DDD的认知(一)