Skip to content

New returns optional of owning reference - #914

Closed
iprtel wants to merge 11 commits into
hsutter:mainfrom
iprtel:New_returns_optional_owning_reference
Closed

iprtel wants to merge 11 commits into
hsutter:mainfrom
iprtel:New_returns_optional_owning_reference

Conversation

@iprtel

@iprtel iprtel commented Dec 29, 2023

Copy link
Copy Markdown
Contributor

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

hsutter commented Oct 31, 2024

Copy link
Copy Markdown
Owner

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