Fix signature of QDebug::toString()

We don't need two overloads here.

Change-Id: Ia6a3bcd93491843e07b0295fefe8da42ae9d6519
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Lars Knoll 2020-10-15 09:10:08 +02:00
parent 0461c535fc
commit 4097653215
2 changed files with 3 additions and 19 deletions

View File

@ -714,14 +714,7 @@ QDebug &QDebug::resetFormat()
*/
/*!
\fn template <class T> QString QDebug::toString(const T &object)
\since 6.0
\include qdebug-toString.qdocinc
*/
/*!
\fn template <class T> QString QDebug::toString(const T *object)
\fn template <class T> QString QDebug::toString(T &&object)
\since 6.0
\include qdebug-toString.qdocinc

View File

@ -157,20 +157,11 @@ public:
{ stream->ts << m; return *this; }
template <typename T>
static QString toString(const T &object)
static QString toString(T &&object)
{
QString buffer;
QDebug stream(&buffer);
stream.nospace() << object;
return buffer;
}
template <typename T>
static QString toString(const T *object)
{
QString buffer;
QDebug stream(&buffer);
stream.nospace() << object;
stream.nospace() << std::forward<T>(object);
return buffer;
}
};