QT6 function overloading – QList redefinition of QVector

I have an compilation error "error: redefinition of ‘from_json’" with that code:

#include <QVector>
#include <QList>
#include <QDebug>

template<typename OwnType> void from_json(QVector<OwnType> &p)
    qDebug() << "QVector";

template<typename OwnType> void from_json(QList<OwnType> &p)
    qDebug() << "QList";

But i getting that compilation error only in QT6. In QT5 that compilling and working successfully. Whats wrong?

c++17 MinGW

>Solution :

In Qt6, QVector is just an alias for QList.

Leave a Reply