Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.5.2
-
None
-
MSVC 2022 (17.4)
Description
When I try to use QList constructor QList::QList(InputIterator first, InputIterator last) with the iterators of a range, I get
warning: C4996: 'QList<Node>::const_iterator::operator T': Use operator* or operator-> rather than relying on the implicit conversion between a QList/QVector::const_iterator and a raw pointer
Sample code:
#include <ranges> #include <QDebug> struct Node { public: int m_Id; //... }; auto convertToIdListView(const auto& arg) { auto fConvertToId = [](const Node& node) { return node.m_Id; }; auto idListView = std::views::transform(arg,fConvertToId); return idListView; } QList<int> convertToIdList(const QList<Node>& arg) { const auto idListView = convertToIdListView(arg); return {QList<int>{idListView.begin(), idListView.end()}}; } int main(int argc, char *argv[]) { QList<Node> nodeList{{.m_Id=1},{.m_Id=2},{.m_Id=5}}; qDebug() << convertToIdList(nodeList); }