Skip to content

Commit

Permalink
C4SortObjectMultiple::PrepareCache: Don't use std::any_of since it sh…
Browse files Browse the repository at this point in the history
…ort-circuits
  • Loading branch information
Fulgen301 committed Nov 11, 2023
1 parent a58d187 commit 356ccdd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/C4FindObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,11 @@ int32_t C4SortObjectMultiple::Compare(C4Object *pObj1, C4Object *pObj2)

bool C4SortObjectMultiple::PrepareCache(std::vector<C4Object *> &objects)
{
return std::any_of(ppSorts, ppSorts + iCnt, [&objects](C4SortObject *const sort) { return sort->PrepareCache(objects); });
bool fCaches = false;
for (int32_t i = 0; i < iCnt; ++i)
fCaches |= ppSorts[i]->PrepareCache(objects);
// return wether a sort citerion uses a cache
return fCaches;
}

int32_t C4SortObjectMultiple::CompareCache(int32_t iObj1, int32_t iObj2, C4Object *pObj1, C4Object *pObj2)
Expand Down

0 comments on commit 356ccdd

Please sign in to comment.