Skip to content
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

shared_ptr::unique not available anymore in C++20 #738

Open
lgeretti opened this issue Feb 23, 2023 · 1 comment
Open

shared_ptr::unique not available anymore in C++20 #738

lgeretti opened this issue Feb 23, 2023 · 1 comment
Labels
deficiency Un undesirable feature which is not a bug

Comments

@lgeretti
Copy link
Member

Apparently the method has been removed, but this shows up only using MSVC.
We should address this, since it is used in Handle. I currently work around it by just not checking for uniqueness and making a unique one anyway.

@lgeretti lgeretti added the deficiency Un undesirable feature which is not a bug label Feb 23, 2023
@pietercollins
Copy link
Contributor

In Handle<const I> we can safely used shared_ptr without copying.

For non-const Handle<I>, if we can't rely on shared_ptr::unique then we either need to copy on every non-constant access (horrible) or make a deep copy when the handle is copied. This seems like the only sensible solution. We then might as well use unique_ptr. Of course, we can pass the object by reference to avoid copying, and we can use move-constructors where possible.

I suggest we make a template specialisation of Handle<const I> using shared_ptr and use unique_ptr in Handle<I>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deficiency Un undesirable feature which is not a bug
Development

No branches or pull requests

2 participants