On 10/05/13 16:26, Julian Gonggrijp wrote:
Larry Evans wrote:
https://github.com/jgonggrijp/rich-typed-pointers [snip] If there were a templated owned_ptr CTOR:
template<typename Derived> owner_ptr (owner_ptr<Derived> && source) : pointer(source.pointer) { source.pointer = nullptr; }
wouldn't that eliminate the need for the make_dynamic templated function?
Just wondering. I haven't tried it, but I'd guess it would work because the ownd_ptr<Derived> could be constructed with the:
make<Derived>(t1,t2,...tn)
and then the templated owned_ptr CTOR would then convert that to the base class?
I agree this would be great, but unfortunately it appears it can't be done. owner_ptr<Derived> would have to friend-declare owner_ptr<Base>, I don't see why. AFAICT, you'd require *fewer* friend declarations, not more( you wouldn't need the:
template