3 ms·
The map being heap allocated somewhere means this, in its most basic form: { map<whatever> *ptr = new map<whatever> ; // forgotten delete } If yo
by kazinator 10y ago
The map being heap allocated somewhere means this, in its most basic form:
{
map<whatever> *ptr = new map<whatever> ;
// forgotten delete
}
If you don't want the heap allocated map to leak, and you want that management to be automated, you need some smart pointer type to reference it; map itself doesn't help.
All RAII-driven management of heap resources is tied to some scope somewhere. Anything not tied to scoping has to be treated explicitly: try to calculate the lifetime and explicitly dispose of the resource.
- lomnakkus 10y agoAFAICT you're saying that RAII = RC. Am I correct in thinking that?