[Qt-interest] correct usage of qt smart pointers ?

Anton Chernov mechernov at gmail.com
Tue May 10 09:58:36 CEST 2011


QWeakPointer are used only to track the object, not to work with.

2011/5/9 jjDaNiMoTh <jjdanimoth at gmail.com>

> 2011/5/9 jjDaNiMoTh <jjdanimoth at gmail.com>:
> > 2011/5/9 Matthias Pospiech <matthias.pospiech at gmx.de>:
> >> I want to store derived classes pointer in a base class vector.
> >> The saved pointer shall be accesible, but not deletable from outside
> >
> > When I was searching a thing (which was likely to yours) I
> > encountered, on the Parashift's c++ faq, the following statement:
> >
> > "And nothing in C++ "prevents" people from doing the wrong thing" [1]
> >
> > Consider only to write a comment, like "Never delete" or "I will
> > delete this in the future, don't care about that".
> >
> > [1]
> http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.12
> >
>
> And also (sry for double-posting) if you don't want modifications,
> consider using right "const"  [1] word.
>
> [1] http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.5
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110510/f5114cc9/attachment.html 


More information about the Qt-interest-old mailing list