First of all, this is not a fictitious question about overloading arrays or operators []!
I tried to compile Qt Creator and I got an error in this method:
static QList<IDocumentFactory*> getNonEditorDocumentFactories()
{
return ExtensionSystem::PluginManager::getObjects<IDocumentFactory>(
[](IDocumentFactory *factory) {
return !qobject_cast<IEditorFactory *>(factory);
});
}
Error:
mainwindow.cpp:748: error: expected primary-expression before ‘[’ token
mainwindow.cpp:748: error: expected primary-expression before ‘]’ token
mainwindow.cpp:748: error: expected primary-expression before ‘*’ token
mainwindow.cpp:748: error: ‘factory’ was not declared in this scope
I know that I am doing something wrong to compile Qt Creator, possibly a version of g ++, but that is not the question.
I would like to understand this code because for me this use []is syntactically incorrect. Can someone please explain to me what is happening here.
source
share