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

Konstantin Tokarev annulen at yandex.ru
Tue Jun 14 17:22:40 CEST 2016

14.06.2016, 18:03, "Bo Thorsen" <bo at vikingsoft.eu>:
> Den 13-06-2016 kl. 12:16 skrev Denis Shienkov:
>>>  QScopedPointer?
>>  Do you have real example? ;)
> Well, as Sean wrote it lacks the move, but if all you're after is to use
> it for a pointer in a class or make a local dynamically allocated var
> exception safe, then QScopedPointer is fine. It's limited in it's use,
> but that doesn't mean it's unusable.

QScopedPointer lacks custom deleters which make it unusable for the purpose of managing Windows HANDLEs (see original post).

However, author of [1] argues that managing non-pointer resources with unique_ptr + custom deleter is sub-par, and proposes different approach based on explicit specialization

[1] http://accu.org/index.php/journals/2086


More information about the Development mailing list