[Solved] Why is the destructor called when the object is passed by reference?


You have a local variable of type Entry, which is automatically destroyed at the end of the function.

When it is destroyed, destructors run for each of its subobjects.

Probably entry.m_value = value; is copying something, and the extra copy needs to be cleaned up.

2

solved Why is the destructor called when the object is passed by reference?