[Development] unique_ptr vs. QSharedPointer

Marc Mutz marc.mutz at kdab.com
Tue May 3 13:31:21 CEST 2016


On Tuesday 03 May 2016 13:14:05 Shawn Rutledge wrote:
> In what ways are they different?

One implements unique ownership, isn't copyable, only movable, has almost zero 
overhead (with a stateless deleter), and is standardised from C++11 on, the 
other implements shared ownership, is copyable and movable, has the overhead 
of a separate control block, and is Qt-specific.

> Is it OK to use unique_ptr in public API starting in 5.7?

No.

> How about in internal implementation?

We have no experience, except in platform-specific code.

Thanks,
Marc

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - Qt, C++ and OpenGL Experts



More information about the Development mailing list