Replace size() method with empty() when possible.

There is no guaranteed that size() is a constant-time function.
This commit is contained in:
Haojian Wu 2017-03-30 21:44:15 +02:00
parent e4c571fc68
commit d18b34d55f
4 changed files with 5 additions and 6 deletions

View file

@ -205,7 +205,7 @@ vector<FilePath> Index::Search(string query) {
vector<FilePath> result;
FileIdsMap::const_iterator ids_it = file_ids_.begin();
for (; ids_it != file_ids_.end(); ++ids_it) {
if (trigrams.size() == 0 ||
if (trigrams.empty() ||
file_ids.find(ids_it->second) != file_ids.end()) {
result.push_back(ids_it->first);
}