[Development] Can we use std::unique_ptr in Qt base/modules sources since Qt5.7 ?
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:
>> 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  argues that managing non-pointer resources with unique_ptr + custom deleter is sub-par, and proposes different approach based on explicit specialization
More information about the Development