Codechange: Use std::unique_ptr for link graph schedule handlers. (#12988)

This removes manual memory management.
This commit is contained in:
Peter Nelson
2024-10-15 02:11:06 +01:00
committed by GitHub
parent 4a6ac52d8c
commit d5b57a56f4
2 changed files with 7 additions and 10 deletions

View File

@@ -143,12 +143,12 @@ void LinkGraphSchedule::ShiftDates(TimerGameEconomy::Date interval)
*/
LinkGraphSchedule::LinkGraphSchedule()
{
this->handlers[0] = new InitHandler;
this->handlers[1] = new DemandHandler;
this->handlers[2] = new MCFHandler<MCF1stPass>;
this->handlers[3] = new FlowMapper(false);
this->handlers[4] = new MCFHandler<MCF2ndPass>;
this->handlers[5] = new FlowMapper(true);
this->handlers[0] = std::make_unique<InitHandler>();
this->handlers[1] = std::make_unique<DemandHandler>();
this->handlers[2] = std::make_unique<MCFHandler<MCF1stPass>>();
this->handlers[3] = std::make_unique<FlowMapper>(false);
this->handlers[4] = std::make_unique<MCFHandler<MCF2ndPass>>();
this->handlers[5] = std::make_unique<FlowMapper>(true);
}
/**
@@ -157,9 +157,6 @@ LinkGraphSchedule::LinkGraphSchedule()
LinkGraphSchedule::~LinkGraphSchedule()
{
this->Clear();
for (const auto &handler : this->handlers) {
delete handler;
}
}
/**