Но сам по себе деструктор, выбрасывающий исключения, настолько плох? Например (полный пример):
Код: Выделить всё
struct A
{
int a;
char b;
A() : a(10), b('a') { }
~A(){ throw std::exception(); }
};
int main()
{
A a; //destructor throws, but there're no more objects to destruction
//therefore I think there's no memory leak
}
Подробнее здесь: https://stackoverflow.com/questions/311 ... -exception
Мобильная версия