作者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