From 40976532158fc49be45bb976455f48e98f9690cf Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 15 Oct 2020 09:10:08 +0200 Subject: Fix signature of QDebug::toString() We don't need two overloads here. Change-Id: Ia6a3bcd93491843e07b0295fefe8da42ae9d6519 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.cpp | 9 +-------- src/corelib/io/qdebug.h | 13 ++----------- 2 files changed, 3 insertions(+), 19 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index c711c28f62..1a0ec17397 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -714,14 +714,7 @@ QDebug &QDebug::resetFormat() */ /*! - \fn template QString QDebug::toString(const T &object) - \since 6.0 - - \include qdebug-toString.qdocinc -*/ - -/*! - \fn template QString QDebug::toString(const T *object) + \fn template QString QDebug::toString(T &&object) \since 6.0 \include qdebug-toString.qdocinc diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 3498351639..b737d3e41a 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -157,20 +157,11 @@ public: { stream->ts << m; return *this; } template - static QString toString(const T &object) + static QString toString(T &&object) { QString buffer; QDebug stream(&buffer); - stream.nospace() << object; - return buffer; - } - - template - static QString toString(const T *object) - { - QString buffer; - QDebug stream(&buffer); - stream.nospace() << object; + stream.nospace() << std::forward(object); return buffer; } }; -- cgit v1.2.3