I think, if we decide to re-implement parent-child model using smart pointers, we would not use unique pointers at all. Even in a methods like QObject::makeChild (because ownership is already defined). Shared + weak pointers make perfect sense here. The main reason is that many other objects might need to store weak references to a child of QObject, and I don't see how to properly utilize unique pointer in this case.
Just in case, it was only my assumptions. No decisions were made, no proper experiments were performed. On 2/4/20 9:28 AM, Fawzi Mohamed wrote: > Hi Daniel, > I agree with most of your choices, and yes there will be cases where a change > in QT is required. > What I did not fully understand is why you did not go the whole way and used > unique_ptr also in QObject, as Vitaly suggested: your invariant is either > owned by a unique_ptr or a QObject, if QObject uses unique_ptr then it > reduces to unique_ptr ownership. > Do you get too much boilerplate, or need to continuously get the raw pointer? > Maybe you told already, and I missed it, but that could also show the issues > of using unique_ptr. > To me it seems that it makes ownership in our API clearer, and that is a win, > but André’s comments I think show his concern with bloating up code and > conceptual burden for little or no gain. > _______________________________________________ > Development mailing list > [email protected] > https://lists.qt-project.org/listinfo/development -- Best Regards, Fanaskov Vitaly Senior Software Engineer The Qt Company / Qt Quick and Widgets Team _______________________________________________ Development mailing list [email protected] https://lists.qt-project.org/listinfo/development
