You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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> and spimpl::unique_impl_ptr<DerivedType> are not related classes, so they cannot access private nor protected members of each other.
I see that std::unique_ptr has a similar move constructor from a convertible instance of the pointer, so this could have some use.
A solution to this problem could be marking all instantiations of spimpl::unique_impl_ptr friends of each other (like described here). The same could be done for spimpl::impl_ptr.
A impl ptr implementation should only inherit functions of std::unique_ptr which are relevant to PIMPLs. Is having such move constructor relevant for PIMPLs? I'm open to discussion.
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 theu
argument. If it's called like this:spimpl::unique_impl_ptr<BaseType>
andspimpl::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.
The text was updated successfully, but these errors were encountered: