Hi,
I came across a strange use of the destructor while working on an existing library. The destructor of a stack allocated stl vector was being called explicitly, when its the case that that object may need to be used again. These vector objects are a slightly customised version of the stl vector class that have a specialized clear
method. In the destructor body there exist two method calls: clear()
, _Tidy()
.
I've been trying to think of a good reason why this destructor is being called rather than just clear
but I'm at a loss. Anyone shed any light on why this may be a good idea?