Разрешено ли delete this;, если оператор delete является последним оператором, который будет выполняться в этом экземпляре класса? Конечно, я уверен, что объект, представленный this -pointer, new ly-created.
Я думаю о чем-то вроде этого:
void SomeModule::doStuff()
{
    // in the controller, "this" object of SomeModule is the "current module"
    // now, if I want to switch over to a new Module, eg:
    controller->setWorkingModule(new OtherModule());
    // since the new "OtherModule" object will take the lead, 
    // I want to get rid of this "SomeModule" object:
    delete this;
}
Могу ли я это сделать?
