novelrt / NovelRT

A cross-platform 2D game engine accompanied by a strong toolset for visual novels.
MIT License
183 stars 43 forks source link

[WIP] Replace Try methods that use out ref to pass the value to std optional #582

Open RyadaProductions opened 1 year ago

RyadaProductions commented 1 year ago

What kind of change does this PR introduce? Code API change to move to a method signature that returns an optional instead of being invoked with a pass by ref parameter that is then set.

Is there an open issue that this resolves? 563.

What is the current behavior? Method signature is generally something along the lines of: bool TrySomething(T& outParam);

What is the new behavior (if this is a feature change)? New method signature most of the time is now: std::optional<T&> TrySomething()

Does this PR introduce a breaking change? Yes this breaks the API in multiple spots but generally not for the end user yet as it's mostly isolated in engine code.