You are looking for QScopedPointer::reset().
Christian (sorry about the format, sending via Outlook webmail) ________________________________________ From: interest-bounces+christian.kandeler=digia....@qt-project.org [interest-bounces+christian.kandeler=digia....@qt-project.org] on behalf of Alex Strickland [s...@mweb.co.za] Sent: 18 September 2012 16:58 To: interest@qt-project.org Subject: [Interest] QScopedPointer with Hi This is really a general C++ question, but I have looked long and hard and not worked it out. In the code below how should I initialise v.v using the QScopedPointer? #include <QScopedPointer> class abc { }; class a : public abc { }; class x { public: QScopedPointer<abc> v; }; int main() { x y; y.v = new a; // error: C2679: binary '=' : no operator found which takes a right-hand operand of type 'a *' (or there is no acceptable conversion) y.v = dynamic_cast<QScopedPointer<abc>>(new a); // error: C2680: 'QScopedPointer<T>' : invalid target type for dynamic_cast } Thanks for any help. -- Regards Alex _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest