Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of symbol "vector deleting destructor" in VC++?

This symbol seems to be a compiler generated destructor. What is the difference between this one, 'compiler generated destructor' and 'scalar deleting destructor'? Are there any other types of compiler generated ctor/dtor?

like image 721
Thomson Avatar asked Jun 26 '12 08:06

Thomson


1 Answers

Functions named 'scalar deleting destructor' and 'vector deleting destructor' are helper functions created by VC compiler when generating code for delete statement. Don't confuse them with the class destructor which also may be generated by the compiler. The former can be expressed in pseudocode as

void scalar_deleting_destructor(A* pa)
{
pa->~A();
A::operator delete(pa);
}

and the latter as

void vector_deleting_destructor(A* pa, size_t count)
{
for (size_t i = 0; i < count; ++i)
pa[i].~A();
A::operator delete[](pa);
}
like image 197
Andrey Avatar answered Sep 28 '22 01:09

Andrey