-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I don't understand the purpose of unique_impl_ptr(unique_impl_ptr< U, D > &&u). spimpl seems to care about construction/assignment from not only types identical to T, but also types convertible to it.
What is the use case for this feature? The PIMPLs I know don't use inheritance often.
Also, I have noticed this function in particular because it contains a bug. It tries to access the ptr_ protected member of the u argument. If it's called like this:
spimpl::unique_impl_ptr<BaseType>(spimpl::unique_impl_ptr<DerivedType>());spimpl::unique_impl_ptr<BaseType> and spimpl::unique_impl_ptr<DerivedType> are not related classes, so they cannot access private nor protected members of each other.
EDIT: spimpl::impl_ptr::impl_ptr(spimpl::impl_ptr::impl_ptr<U, D, C> &&) suffers from the same problem.
EDIT 2: spimpl::impl_ptr::operator=(const spimpl::impl_ptr::impl_ptr<U, D, C> &) seems to lead to different and more subtle errors.
I would have made a PR for this (like I've done before), but I am not sure what would be the best way to fix this.