[Interest] QScopedPointer with

Kandeler Christian Christian.Kandeler at digia.com
Tue Sep 18 17:02:22 CEST 2012


You are looking for QScopedPointer::reset().


Christian (sorry about the format, sending via Outlook webmail)

________________________________________
From: interest-bounces+christian.kandeler=digia.com at qt-project.org [interest-bounces+christian.kandeler=digia.com at qt-project.org] on behalf of Alex Strickland [sscc at mweb.co.za]
Sent: 18 September 2012 16:58
To: interest at 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 at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list