[Development] Making QScopedPointer scoped (again)

Thiago Macieira thiago.macieira at intel.com
Tue Sep 3 23:00:39 CEST 2013


On terça-feira, 3 de setembro de 2013 22:50:53, Stephen Kelly wrote:
> >  QGraphicesView::addItem(QScopedPointer<QGraphicsItem> item)
> > 
> >
> > now you know that the the ownership is taken by the view.
> 
> Peter said what I was going to say. When the need to add such a method
> arises,  you should write a QUniquePointer. You should not shoehorn moving
> into QScopedPointer thereby breaking the meaning of QScopedPointer.

Note that you should probably not use even std::unique_ptr for the case above.

You probably want N3740[1] A Proposal for the World's Dumbest Smart Pointer.

[1] http://isocpp.org/files/papers/n3740.pdf

-- 
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/development/attachments/20130903/b14b2f6f/attachment.sig>


More information about the Development mailing list