Skip to content

Commit

Permalink
Merge branch 'bloomberg:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-e1off authored Oct 24, 2023
2 parents 0eeedb6 + 708d49b commit cea51ee
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/groups/mqb/mqbs/mqbs_storagecollectionutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,31 @@ void StorageCollectionUtil::loadStorages(StorageList* storages,
}
}

namespace {

template <class Predicate>
struct Not1 {
Not1(const Predicate& predicate)
: d_predicate(predicate)
{
}

template <class Value>
bool operator()(const Value& value) const
{
return !d_predicate(value);
}
Predicate d_predicate;
};

template <class Predicate>
Not1<Predicate> not_pred(const Predicate& predicate)
{
return Not1<Predicate>(predicate);
}

} // close anonymous namespace

void StorageCollectionUtil::filterStorages(StorageList* storages,
const StorageFilter& filter)
{
Expand All @@ -164,7 +189,7 @@ void StorageCollectionUtil::filterStorages(StorageList* storages,

StorageListIter iter = bsl::remove_if(storages->begin(),
storages->end(),
bsl::not1(filter));
not_pred(filter));
storages->erase(iter, storages->end());
}

Expand Down

0 comments on commit cea51ee

Please sign in to comment.