动态实例化类,然后立即将其删除
Dynamically instancing a class then deleting it right away?
我创建了自己的类,但是当我尝试实例化它时,我遇到了一堵墙。
这是我的代码:
m_interpolation = new Interpolation(m_mesureList, width, height, parent);
delete m_interpolation;
这将生成错误:
我0B3E9E40 处的堆块在 0B3E9E68 处修改,请求的大小为 20
看不出我做错了什么...
有关信息,这里是我的类 Interpolation.h 和 Interpolation 的完整定义.cpp如果这有任何帮助的话。
添加了一个析构函数,但仍然没有解决问题。
Interpolation::~Interpolation()
{
delete m_progress;
m_progress = 0;
}
在 ctor 中:填充m_w
:最多 (m_N-1)
for (int i(0); i < m_N; ++i)
{
m_pt.push_back(QPointF(mesureList[i]->getX(), mesureList[i]->getY()));
m_w.push_back(mesureList[i]->getAngle());
}
稍后:访问m_w[m_N]
,超出向量的末尾
for (i = m_N; i >= 0; --i)
{
sum = m_w[i];
for (j = i+1; j < m_N; j++) sum -= LU[i][j]*m_w[j];
m_w[i] = sum / LU[i][i];
}
构造函数 Interpolation::Interopolation() 或析构函数 Interpolation::~Interpolation() 中的某些内容超出了对象的大小。
相关文章:
- C++读取大文件并将其保存到字符串中,然后删除特定的随机单词
- 如何在C++中将类的实例完全重新分配给同一类的另一个实例(然后删除原始对象)?
- 如何检查单向链表的每个 3 个元素,然后删除其中一些元素?
- 如何在每次循环迭代期间生成向量,存储数据,然后删除该向量?
- 截取屏幕截图,分析它,然后删除它
- 如何修改数组,从中删除空格,然后将其存储在新数组中
- 显示然后删除链接列表C
- 当我递增指针然后将其删除时,为什么我的程序会崩溃
- 删除后C 指针,然后给出值
- 删除指针的成员数组,然后重新分配它
- STD :: MAP-如何查找或添加,然后可以在一次搜索中删除项目
- 使用fstream在文件中覆盖一些文本,然后删除文件的其余部分
- 在2D向量中找到一个元素,然后将其删除
- std::vector 删除重复项,然后删除另一个向量中的相同索引
- 从文本文件中读取的代码,删除停止语,然后应用大小写折叠
- 强制程序以Root身份启动,然后将其删除
- 删除停止语,然后应用大小写折叠(如何组合两个代码)
- 将迭代器存储在临时容器上,然后从其他容器中删除它们
- 动态实例化类,然后立即将其删除
- 复制阵列,然后删除原始阵列