From 1e8e79d71e9e1a7ea1aa17dc16f3c17fd2e22eed Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 22 May 2017 15:15:19 +0200 Subject: QScopedArrayPointer: document the most important ctor The ctor that everyone would want to use was marked as \internal, probably because of the SFINAE expression appearing in its signature. Move the SFINAE to the template argument list, which QDoc hides from the user, and drop the \internal. While at it, drop the home-grown std::is_same re-implementation and use the real deal. Change-Id: Ia357fe65f94e10ac9eeccb3490aa8b3e68114cbb Reviewed-by: Lars Knoll --- src/corelib/tools/qscopedpointer.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/corelib/tools/qscopedpointer.h') 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) { } -- cgit v1.2.3