有谁用过Wm5::Pointer1这个智能指针?
现在需要给这个指针赋值?这写的如下代码,编译可以过去,但运行就挂掉
Wm5::Pointer1<Wm5::Vector2<float> > pVector2Temp;
//Wm5::Vector2<float> *pVector2Temp = new Wm5::Vector2<float> [intersectionPoints[i].size()];
for (int j = 0; j < intersectionPoints[i].size() ; j++)
{
//pVector2Temp[j] = intersectionPoints[i][j];
//pVector2Temp = Wm5::Vector2<float>(0,0);
Wm5::Vector2<float> test;
test.X() = 0;
test.Y() = 0;
pVector2Temp[j] = test;
到赋值那一步会出现Object reference not set to an instance of an object.这个错误
[解决办法]
没实例化一个对象进行的非法操作了!
你运行就挂掉,估计是哪里调用了空指针引起的了
[解决办法]
调戏一下程序。
[解决办法]
得分配内存的,试试这样呢。
Wm5::Pointer1<Wm5::Vector2<float> > pVector2Temp(new Wm5::Vector2<float> [intersectionPoints[i].size()]);