[Development] unique_ptr and Qt, Take 2

Иван Комиссаров abbapoh at gmail.com
Fri May 3 19:58:30 CEST 2019


IMHO, it should be a Qt6 feature. It’s awesome.

However, I liked the idea (is it deprecated or what?) of a template method
template<typename T, typename Args…> 
std::observer_ptr<QObject> qMakeChild(gsll::not_null<std::observer_ptr<QObject>> parent, Args… args)
{
    return parent->adoptChild(std::make_unique<T>(args));
}

With that method, you don’t need to implement stuff like 
QLibrary::QLibrary(QParentPtr<QObject *> parent, const QString &fileName),
You just need to split ctor into safe and unsafe versions and deprecate unsafe.

Maybe I’m asking too much, but it would be nice get rid of raw pointers completely switching to pair std::unique_ptr/std::observer_ptr

> 3 мая 2019 г., в 19:22, Daniel Teske <qt at squorn.de> написал(а):
> 
> So, who thinks that this is something that ought to be a Qt6 feature? 
> 
> And who wants to actually help make that happen? 
> 
> daniel 
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190503/470b0f7e/attachment-0001.html>


More information about the Development mailing list