[Development] unique_ptr and Qt, Take 2

Konstantin Tokarev annulen at yandex.ru
Tue May 7 16:27:34 CEST 2019


>> Can you explain what you mean with “understands the parent/child-ownership model”?
>>
>> Are you suggesting a unique_ptr-like template class that doesn’t destroy the object in its destructor if that object still has a parent?
>
> It could be something like that. One option could be to behave like a unique_ptr if the object doesn’t have a parent, and like a weak pointer otherwise. One would have to try it out though, to see whether that would give semantics that are intuitive and feel right to users.

Intuitive behavior would be to behave like weak pointer if object has a parent and is a direct class member of its parent object, otherwise behave like a unique_ptr.


-- 
Regards,
Konstantin



More information about the Development mailing list