You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Application::changeState() should return a reference to the new AppState instance so that calling code can interact with it beyond passing constructor arguments.
Additionally, something should be done about the destruction of the old AppState object inside the call - generally an AppState will be making the call to changeState() and will thus be destructing itself. This is dangerous even if documented.
I'm thinking of returning both the old and the new in a std::pair<std::unique_ptr<AppState>, std::reference_wrapper<NewState>> or making a simple custom struct to label them previous and current.
The text was updated successfully, but these errors were encountered:
Application::changeState()
should return a reference to the newAppState
instance so that calling code can interact with it beyond passing constructor arguments.Additionally, something should be done about the destruction of the old
AppState
object inside the call - generally anAppState
will be making the call tochangeState()
and will thus be destructing itself. This is dangerous even if documented.I'm thinking of returning both the old and the new in a
std::pair<std::unique_ptr<AppState>, std::reference_wrapper<NewState>>
or making a simple custom struct to label themprevious
andcurrent
.The text was updated successfully, but these errors were encountered: