Skip to content

New returns optional of owning reference #914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

iprtel
Copy link
Contributor

@iprtel iprtel commented Dec 29, 2023

This patch represents a suggestion:
Default new should return std::optional<owning_reference> 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.

@hsutter
Copy link
Owner

hsutter commented Oct 31, 2024

Hi! Sorry it took so long to touch base on this. I think the current design is sufficient at least for now so I'll close this, but I appreciate the idea. Thanks!

@hsutter hsutter closed this Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants