3 ms·
That's too strong of a critique. You can have just a handle on the stack, with the data on the heap. When the destructor of the handle is executed, it deallocat
by dmunoz 13y ago
That's too strong of a critique. You can have just a handle on the stack, with the data on the heap. When the destructor of the handle is executed, it deallocates the data on the heap. This is what almost all resource holding library or user-defined types do in C++.
- taybin 13y agoSure, but at that point, it's not RAII all the way down. RAII is a great wrapper around new and delete, but I saw people talking about how they rarely use new and delete anymore. Edit: Actually, reading about auto_ptr<> and friends I see what you're getting at. The codebase I worked on some years ago didn't use those so I'm not totally familiar with that idiom for wrapping heap allocation.