[Development] Making QScopedPointer scoped (again)
Stephen Kelly
stephen.kelly at kdab.com
Tue Sep 3 12:07:09 CEST 2013
On Tuesday, September 03, 2013 11:57:06 you wrote:
> On Tue, Sep 03, 2013 at 11:44:58AM +0200, Stephen Kelly wrote:
> > Em, what?
> >
> > I suppose you didn't read the patch. Am I correct?
> >
> > The patch *only* has an effect for people using C++11, where it is
> > redundant because of std::unique_ptr.
> >
> > The original patch only tries to make QScopedPointer something it's not.
>
> Another thing to keep in mind is that QScopedPointer is also partially
> redundant with std::auto_ptr.
std::auto_ptr is very different to QScopedPointer.
I suppose 'partially' is the operative word in your sentence, but that makes
your sentence meaningless. You can make a claim of 'partial' redundance with
anything.
{
std::shared_ptr<int> p = someCreateApi();
// p refcount is 1
} // p refcount is 0. delete.
"std::shared_ptr is partially redundant with std::unique_ptr" !!!
I don't buy the partial redundance claim at all.
QScopedPointer has a reason to exist. It does not have a reason to be movable.
> Yet, it exists and people use it instead.
> QScopedPointer is also used in many classes as a member, which conflicts
> with its name, and it does that job pretty well anyway.
There is no conflict. In that case the QScopedPointer instance is scoped to
the class instance.
Thanks,
--
Join us in October at Qt Developer Days 2013 - https://devdays.kdab.com
Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130903/9946d652/attachment.sig>
More information about the Development
mailing list