QDebug: add support for QVarLengthArray

Remove a conflicting definition of the same operator from
qrhi.cpp. Who knows how many ODR violations this hidden gem may have
caused...

[ChangeLog][QtCore][QDebug] Can now stream QVarLengthArray objects.

[ChangeLog][QtCore][QVarLengthArray] Can now be output via QDebug
streaming.

Change-Id: I12f7670e32029fa8c96b446e9a98ebf3b9732d0d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Marc Mutz 2021-06-07 09:49:23 +02:00
parent cffc667ad9
commit 734429f4a3
2 changed files with 7 additions and 6 deletions

View File

@ -48,6 +48,7 @@
#include <QtCore/qtextstream.h>
#include <QtCore/qstring.h>
#include <QtCore/qset.h>
#include <QtCore/qvarlengtharray.h>
#include <QtCore/qcontiguouscache.h>
#include <QtCore/qsharedpointer.h>
@ -249,6 +250,12 @@ inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, const QList<T> &vec)
return QtPrivate::printSequentialContainer(debug, "QList", vec);
}
template<typename T, qsizetype P>
inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, const QVarLengthArray<T, P> &vec)
{
return QtPrivate::printSequentialContainer(debug, "QVarLengthArray", vec);
}
template <typename T, typename Alloc>
inline QDebugIfHasDebugStream<T> operator<<(QDebug debug, const std::vector<T, Alloc> &vec)
{

View File

@ -1366,12 +1366,6 @@ size_t qHash(const QRhiVertexInputLayout &v, size_t seed) noexcept
}
#ifndef QT_NO_DEBUG_STREAM
template<typename T, qsizetype N>
QDebug operator<<(QDebug dbg, const QVarLengthArray<T, N> &vla)
{
return QtPrivate::printSequentialContainer(dbg, "VLA", vla);
}
QDebug operator<<(QDebug dbg, const QRhiVertexInputLayout &v)
{
QDebugStateSaver saver(dbg);