-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Labels
Description
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.