→ bachelorwhc: delete是對記憶體位置 你不去delete 就會一直在那邊 01/21 15:41
→ bachelorwhc: 接return value的 用smart pointer包起來 確保不用時 01/21 15:42
→ bachelorwhc: 自動釋放 01/21 15:43
噓 grayStone: 感覺... 直接試試看 或是把記憶體位址印出來看 01/21 16:42
推 Bencrie: 不會。可以。正常,通常文件會提醒你要 free 01/21 17:55
→ ntucorner: 感謝 01/21 21:15
推 LPH66: 這裡也有一個做法是類似給 FILE* 的 fopen/fclose 函數對 01/21 21:33
→ LPH66: 索取跟釋放資源時各使用一個特定函數 01/21 21:34
→ LPH66: 這樣 free 就能寫在釋放函數裡面了 01/21 21:34
推 eye5002003: 聽起來用smart pointer是最佳解了 01/24 22:51