Am 02.02.2020 um 18:17 schrieb Иван Комиссаров:
Can we please return to the discussion about QObject parent/child with smart
pointers rather than discussing Qt/stl naming?
No one answered my question about QObject::deleteLater:
And what about the QObject::deleteLater() method? Any ideas how this should
look like with smart pointers?
So obviously this:
std::unique_ptr<> ptr;
ptr->deleteLater();
should show a warning. Thus, the first step is to annotate deleteLater
with a optional deprecation.
Then two new functions need to be added:
static QObject::deleteLater(QObject *ptr)
which does not violate that invariant. (Unless you take a pointer out of
a unique_ptr and pass it in.)
And a second variant:
static QObject::deleteLater(std::unique_ptr<QObject> ptr)
which quite obviously also keeps the invariant.
I think I missed the function in my patch, but that's how you could
easily do it.
daniel
_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development