diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index 0e8eba2a0f..8d84b3beca 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -303,10 +303,10 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QScopedArrayPointer::QScopedArrayPointer(D * p, QtPrivate::QScopedArrayEnsureSameType::Type = 0) - \internal + \fn QScopedArrayPointer::QScopedArrayPointer(D * p) - Constructs a QScopedArrayPointer and stores the array of objects. + Constructs a QScopedArrayPointer and stores the array of objects + pointed to by \a p. */ /*! diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 92d7df6e5d..141a3f8c70 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -215,21 +215,16 @@ template inline void swap(QScopedPointer &p1, QScopedPointer &p2) Q_DECL_NOTHROW { p1.swap(p2); } - -namespace QtPrivate { - template struct QScopedArrayEnsureSameType; - template struct QScopedArrayEnsureSameType { typedef X* Type; }; - template struct QScopedArrayEnsureSameType { typedef X* Type; }; -} - template > class QScopedArrayPointer : public QScopedPointer { + template + using if_same_type = typename std::enable_if::type, Ptr>::value, bool>::type; public: inline QScopedArrayPointer() : QScopedPointer(Q_NULLPTR) {} - template - explicit inline QScopedArrayPointer(D *p, typename QtPrivate::QScopedArrayEnsureSameType::Type = Q_NULLPTR) + template = true> + explicit QScopedArrayPointer(D *p) : QScopedPointer(p) { }