[Interest] QScopedPointer and c++11 move semantics

Konstantin Tokarev annulen at yandex.ru
Fri Dec 30 20:55:17 CET 2016



30.12.2016, 22:45, "Alexander Dyagilev" <alervdvcw at gmail.com>:
> QScopedPointer var(new QObject, &QObject::deleteLater) - compiles fine.
>
> std::unique_ptr var(new QObject, &QObject::deleteLater) - does not compile.
>
> Is there an easy way I miss?

std::mem_fun(&QObject::deleteLater) should work

>
> On 12/30/2016 10:35 PM, Giuseppe D'Angelo wrote:
>>  Il 30/12/2016 20:32, Alexander Dyagilev ha scritto:
>>>  This requires me to implement a special deleter function somewhere. I'm
>>>  too lazy :)
>>>
>>>  QXXXXPointer is a more convenient way.
>>  QXXXXPointer would still require you to define your custom deleter (as
>>  by default it would delete via operator delete). What would the
>>  advantage be?
>>
>>  Cheers,
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
Regards,
Konstantin



More information about the Interest mailing list