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

Add conversion form UniquePtr<T> to SharedPtr<T> #1119

Open
apbr opened this issue Oct 27, 2022 · 1 comment
Open

Add conversion form UniquePtr<T> to SharedPtr<T> #1119

apbr opened this issue Oct 27, 2022 · 1 comment

Comments

@apbr
Copy link

apbr commented Oct 27, 2022

In C++ you can convert a unique_ptr to a shared_ptr using this constructor:

template<class Y, class Deleter>
shared_ptr(std::unique_ptr<Y, Deleter>&& r);

(source)

If we could do such a conversion in Rust this could at least alleviate the issue described in #885 a bit.
Is there any reason not to add it?

@apbr
Copy link
Author

apbr commented Oct 28, 2022

Seems like there is already a PR implementing this: #1005

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

No branches or pull requests

1 participant