I heard that empty destructor doesn't do anything and calling it doesn't remove the object. But in the code:
#include <iostream>
#include <set>
class a
{
public:
~a()
{}
std::set <int> myset;
};
int main()
{
a object;
object.myset.insert(55);
object.~a();
object.myset.insert(20);
std::cout << object.myset.size();
}
I get: "* glibc detected * /.app: double free or corruption (fasttop):" and then "ABORT".
If it matters I have c++11 flag enabled. So what does empty constructor actually do? It does something and I read it doesn't.