First of all, this is not a dummy question about arrays or operator[] overload!
I was trying to compile Qt Creator and I've received an error in this method:
static QList<IDocumentFactory*> getNonEditorDocumentFactories()
{
return ExtensionSystem::PluginManager::getObjects<IDocumentFactory>(
[](IDocumentFactory *factory) {
return !qobject_cast<IEditorFactory *>(factory);
});
}
The error is:
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'm doing something wrong to compile Qt Creator, probably g++ version, but the question is not that.
I would like to understand this code because for me this use of []
is syntactically incorrect. Can someone please explain me what is happening here.