summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qpointer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qpointer.h')
-rw-r--r--src/corelib/kernel/qpointer.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h
index af7c11e4d7..52bd368301 100644
--- a/src/corelib/kernel/qpointer.h
+++ b/src/corelib/kernel/qpointer.h
@@ -35,6 +35,7 @@
#define QPOINTER_H
#include <QtCore/qsharedpointer.h>
+#include <QtCore/qtypeinfo.h>
#ifndef QT_NO_QOBJECT
@@ -45,6 +46,8 @@ class QVariant;
template <class T>
class QPointer
{
+ Q_STATIC_ASSERT_X(!QtPrivate::is_pointer<T>::value, "QPointer's template type must not be a pointer type");
+
template<typename U>
struct TypeSelector
{
@@ -61,7 +64,14 @@ public:
inline QPointer() { }
inline QPointer(T *p) : wp(p, true) { }
// compiler-generated copy/move ctor/assignment operators are fine!
- inline ~QPointer() { }
+ // compiler-generated dtor is fine!
+
+#ifdef Q_QDOC
+ // Stop qdoc from complaining about missing function
+ ~QPointer();
+#endif
+
+ inline void swap(QPointer &other) { wp.swap(other.wp); }
inline QPointer<T> &operator=(T* p)
{ wp.assign(static_cast<QObjectType*>(p)); return *this; }