[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 21:31:55 CEST 2017


On quarta-feira, 19 de abril de 2017 12:26:48 PDT Nikita Krupenko wrote:
> BTW, is there any advantage of using lambda over the following construction?
> 
> std::unique_ptr<QObject, decltype(std::mem_fn(&QObject::deleteLater))>
> (ptr, std::mem_fn(&QObject::deleteLater));

Yes. I can remember how to write lambdas, but not those functions from the 
Standard Library.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list