cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

New returns optional of owning reference

Open iprtel opened this issue 1 year ago • 0 comments
trafficstars

This patch represents a suggestion: Default new should return std::optional<owning_reference<T>> with owning_reference managing the life time of the object in a similar way as a unique_ptr would with the exception that it is not allowed to be null.

This will allow to move the reference around without null checks.

iprtel avatar Dec 29 '23 21:12 iprtel