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

Thiago Macieira thiago.macieira at intel.com
Sun Jun 12 20:42:00 CEST 2016


On domingo, 12 de junho de 2016 13:59:32 PDT Denis Shienkov wrote:
>  > No, use of the C++11 Standard Library features is not permitted
> 
> Lousy to hear it...
> 
> How to do then RAII to avoid a leaks e.g. for Windows handles (HANDLE,
> HKEY, HDEVINFO and other stuff)?

You can use it if you know all compilers compiling that code will support it.

> BTW: But, I saw unique_ptr in qtbase and qt3d sources...

In qtbase, it's found in:

src/3rdparty/angle/src/libANGLE/Error.h
src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
src/3rdparty/pcre/sljit/sljitNativeARM_32.c
src/gui/text/qfontengine_p.h
src/plugins/platforms/mirclient/qmirclientscreen.cpp
src/plugins/platforms/mirclient/qmirclientwindow.cpp
src/plugins/platforms/mirclient/qmirclientwindow.h

And the qfontengine_p.h match is:
    class Holder { // replace by std::unique_ptr once available


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




More information about the Development mailing list