[bt-devel] Using QSharedPointer instead of boost pointer
Martin Gruner
mg.pub at gmx.net
Sat Apr 25 09:34:25 MST 2009
Eeli,
thanks for the suggestion.
The boost dependency is removed.
mg
On Thursday 23 April 2009 17:40:31 Eeli Kaikkonen wrote:
> ATM the only thing we use the boost library for is the scoped pointer.
> Qt 4.5 offers QSharedPointer. The documentation says:
>
> "QSharedPointer::~QSharedPointer ()
> Destroys this QSharedPointer object. If it is the last reference to the
> pointer stored, this will delete the pointer as well."
>
> And:
>
> "The QSharedPointer is an automatic, shared pointer in C++. It behaves
> exactly like a normal pointer for normal purposes, including respect for
> constness.
>
> QSharedPointer will delete the pointer it is holding when it goes out of
> scope, provided no other QSharedPointer objects are referencing it."
>
> It looks like we could use this instead of the boost::scoped_ptr. At
> least for Windows it would make things easier by reducing dependencies.
> But it requires Qt 4.5 - 4.4 is not enough. This could be done also with
> #ifdefs, depending on the Qt version, so that if Qt >= 4.5 boost is not
> needed.
>
> Martin, you have used the scoped_ptr more. What do you think?
>
> --Eeli Kaikkonen
>
> _______________________________________________
> bt-devel mailing list
> bt-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/bt-devel
More information about the bt-devel
mailing list