ProjectExplorer: Simplify Project::isKnownFile

Use std::binary_search instead of lower_bound. The iterator is not needed.

Change-Id: Ie40441c0780bcf0b912644c4cdfd2d73068fb441
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Orgad Shaneh
2019-01-21 08:57:46 +02:00
committed by Orgad Shaneh
parent 3cc6db090f
commit b46fc4a3b9

View File

@@ -733,10 +733,9 @@ bool Project::isKnownFile(const Utils::FileName &filename) const
{
if (d->m_sortedNodeList.empty())
return filename == projectFilePath();
const auto end = std::end(d->m_sortedNodeList);
const FileNode element(filename, FileType::Unknown, false);
const auto it = std::lower_bound(std::begin(d->m_sortedNodeList), end, &element, &nodeLessThan);
return (it == end) ? false : (*it)->filePath() == filename;
return std::binary_search(std::begin(d->m_sortedNodeList), std::end(d->m_sortedNodeList),
&element, nodeLessThan);
}
void Project::setProjectLanguages(Core::Context language)