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

jjDaNiMoTh jjdanimoth at gmail.com
Mon May 9 15:54:01 CEST 2011


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



More information about the Qt-interest-old mailing list