[Development] Deleter that calls deleteLater() for use with std::unique_ptr<> and other smart pointers
Thiago Macieira
thiago.macieira at intel.com
Wed Apr 19 19:57:40 CEST 2017
On quarta-feira, 19 de abril de 2017 10:48:38 PDT Konstantin Tokarev wrote:
> > auto ptr = QSharedPointer<QObject *>(new QObject,
> > &QObject::deleteLater);
> >
> > So I think this actually belongs in the std-proposals mailing list, not in
> > Qt.
> >
> > Until C++20 gets it, you can use a lambda.
>
> It's not possible to have members with auto-deduced types in non-template
> class, so I actually cannot.
Then don't use auto-deduced types.
auto ptr = std::shared_ptr<QObject *>(new QObject,
[](QObject *o) { o->deleteLater(); });
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list