So far, the range operator has worked on any Qt List type I used, except QDomNodeList
. Since the range operator is defined as: "Used as a more readable equivalent to the traditional for loop operating over a range of values, such as all elements in a container." i can't see any reason why...
QDomNodeList domNodes = doc.elementsByTagName("peripheral");
for (QDomNode node : domNodes)
{
qDebug() << node.nodeName() << "test";
}
...won't compile but the plain old for loop will:
QDomNodeList domNodes = doc.elementsByTagName("peripheral");
for (int i = 0; i < domNodes.size(); ++i)
{
QDomNode node = domNodes.at(i);
qDebug() << node.nodeName() << "test";
}
Compiler output seems rather obvious:
error: 'begin' was not declared in this scope
for (QDomNode node : domNodes)
...
note: 'std::begin'
begin(_Tp (&__arr)[_Nm])
^
^
Plus the same error for std::end
.