英文:
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'm getting that compilation error only in QT6. In QT5, it compiles and works successfully. What's wrong?
C++17 MinGW
英文:
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
答案1
得分: 1
在Qt6中,"QVector" 只是 "QList" 的别名。
英文:
In Qt6, QVector
is just an alias for QList
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论