[Development] The future of smart pointers in Qt API

Fawzi Mohamed Fawzi.Mohamed at qt.io
Tue Feb 4 09:28:47 CET 2020


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.


More information about the Development mailing list