[Development] Can we use std::unique_ptr in Qt base/modules sources since Qt5.7 ?

Konstantin Tokarev annulen at yandex.ru
Wed Jun 15 17:07:25 CEST 2016



15.06.2016, 18:02, "Thiago Macieira" <thiago.macieira at intel.com>:
> On quarta-feira, 15 de junho de 2016 15:44:09 PDT Giuseppe D'Angelo wrote:
>>  Il 14/06/2016 19:01, Sune Vuorela ha scritto:
>>  > You can pass your own classes as handlers, provided that they have a
>>  > public static function void cleanup(T *pointer).
>>  >
>>  > - from the documentation.
>>
>>  However, you can't pass a per-QScopedPointer unique deleter object,
>>  which also makes this part of the API sub-par compared with the Standard...
>
> Or, if you look at the same problem from a different angle, since
> QScopedPointer has the same size as a regular pointer, allowing you to replace
> a regular pointer in a class with it, without causing a binary compatibility
> break, its API is better than the Standard.

std::unique_ptr<T> always has the same size as pointer.

std::unique_ptr<T, Deleter> is different type (thought it also has the same size as pointer if Deleter is stateless)

-- 
Regards,
Konstantin



More information about the Development mailing list