Цитата(boostcoder @ 9.7.2011, 12:43 ) | | деструктор, я так полагаю, вызван не будет? |
Нет, ведь объект не был создан, но будут вызваны деструкторы для всех, полностью инициализированных членов.
| Цитата | An object that is partially constructed or partially destroyed will have destructors executed for all of its fully constructed subobjects, that is, for subobjects for which the constructor has completed execution and the destructor has not yet begun execution.
|
и это
| Цитата | An object that is partially constructed or partially destroyed will have destructors executed for all of its fully constructed subobjects, that is, for subobjects for which the constructor has completed execution and the destructor has not yet begun execution. Should a constructor for an element of an automatic array throw an exception, only the constructed elements of that array will be destroyed. If the object or array was allocated in a new-expression, the matching deallocation function (3.7.3.2, 5.3.4, 12.5), if any, is called to free the storage occupied by the object.
|
главную мысль выделил красным, остальные привел, чтобы из контекста было понятно, что речь идет о выбросе исключения из конструктора, т.е. о частично инициализированных объектах.
Добавлено через 1 минуту и 47 секунд
Цитата(boostcoder @ 9.7.2011, 11:24 ) | | ведь память сначала выделяется, и только потом выполняется конструктор. |
на самом деле да, но это выполняется в виде транзакции, т.е. при исключении происходит откат. |