destructor
- noun
- /dɪˈstrʌktər/
- Specialized
- When an object is no longer needed, its destructor is invoked to free the allocated memory.
Examples
-
OK, so the destructor gets called in the most.
-
The main idea is to leverage the existing work done for the copy constructor and the destructor.
Blog text (18) -
I don't think in my test code any objects have reached the point where they would call their destructor yet.
Blog text (18) -
From what I see of your code, you need a proper destructor in your smart pointer class to call release and fix the counter.
Blog text (18) -
I have yet to implement the destructors, but I think I am having issues aside from that right now.
Blog text (18) -
I added destructor as you suggested, and interestingly, it is called during the bp2 = new B line of code.
Blog text (18) -
They also call the object constructor and destructor, and the C functions don't do that.
-
I thought the new returns a raw pointer of type U, but my Sptr's destructor is called? -- Incyc 2 days ago
Blog text (18) -
Note that this approach also works if the right-hand side isn't T, i.e., you can still leverage a corresponding constructor, the destructor, and swap().
Blog text (18) -
In C++ programming, the destructor is automatically called when an object goes out of scope.
Compounds
- Specialized
A fungus that infects onion plants and causes grey fuzzy leaves
Surface Forms
Morphology
Etymology
Destructor comes from the parts de- ('down' or 'away') and struct ('build'), like in structure. In programming, a destructor is a special function that 'takes apart' an object or frees its memory and resources when the object is no longer needed, so the name keeps the idea of 'undoing a build' or breaking something down.