qt-interest@trolltech.com
[Top] [All Lists]

Re: [Qt-interest] Const correctness with QSharedPointer

Subject: Re: [Qt-interest] Const correctness with QSharedPointer
From: Hostile Fork
Date: Tue, 8 Dec 2009 10:11:08 -0800
> On Mon, Dec 7, 2009 at 4:31 PM, Stephen Jackson <spjackson42@xxxxxxxxx> wrote:

> I'm going to hijack my own thread here, since I have another question
> about QSharedPointers.  Is there a way to maintain polymorphism when
> using QSharedPointers?  

Not too long ago I did a survey of smart pointer variants with respect to this 
issue (for std::auto_ptr, std::unique_ptr, boost::unique_ptr, and 
std::tr1::shared_ptr) and you might find it useful:

        http://hostilefork.com/2009/07/10/smart-pointer-casting-study/

I didn't include QSharedPointer because I did not know about it at that time 
(someone linked me to it after the post).

But I saw in Thiago's followup that it worked for him.  So I'm not going to try 
it just now until there's resolution on which compiler + Qt version doesn't do 
it.  But if that is resolved I'm happy to add a  QSharedPointer example to the 
article with whatever caveats are appropriate.

---Brian
_______________________________________________
Qt-interest mailing list
Qt-interest@xxxxxxxxxxxxx
http://lists.trolltech.com/mailman/listinfo/qt-interest

<Prev in Thread] Current Thread [Next in Thread>