[Interest] Advice on QSharedPointer versus QExplicitlySharedDataPointer

Thiago Macieira thiago.macieira at intel.com
Fri Jul 19 21:38:28 CEST 2013


On sexta-feira, 19 de julho de 2013 23.31.48, Constantin Makshin wrote:
> QSharedPointer is good when you want to use the same object in several
> places without the need to worry about that object's lifetime because the
> [automatic] reference counting takes care of that. Another advantage is
> that it can hold an object of any type, not just ones derived from
> QSharedData. But if C++11 is acceptable for the project, I'd prefer
> std::shared_ptr because of std::make_shared which provides more efficient
> and exception-friendly allocation method.

QSharedPointer::create().

Also exception-safe.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130719/1a685db3/attachment.sig>


More information about the Interest mailing list