作者BattleRoyale (翔焰)
看板EE_DSnP
标题[问题] 有关於delete[]...
时间Sun Apr 27 16:06:42 2008
它call了 freeArr 这个function
里头的要求是这样:
// 1. Get the array size 'n' stored by system,
// which is also the _recycleList index
虽然从.ref中可以很直观地想说delete掉多大的array size
那个size的空间就会丢入recycleList中
不过感觉好有点本末倒置!?(谜)
那这边的这个地方 跟memTest这class中的deleteArr中的idx有没有关系?
附一下code...
void deleteArr(size_t idx) {
assert(idx < _arrList.size());
delete _arrList[idx];
_arrList[idx]=0;
}
(也就是本文第五行的n跟idx有关系吗?)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.4.235
1F:推 ric2k1:没有关系哦! 提示: _arrList[idx] 仍然是个 array 哦! 04/27 17:22