CatapultServer  v0.5.0.1 (Elephant)
ContainerHelpers.h
Go to the documentation of this file.
1 
21 #pragma once
22 
23 namespace catapult { namespace utils {
24 
26  template<typename TMap, typename TPredicate>
27  void map_erase_if(TMap& map, TPredicate predicate) {
28  for (auto iter = map.cbegin(); map.cend() != iter;) {
29  if (predicate(*iter))
30  iter = map.erase(iter);
31  else
32  ++iter;
33  }
34  }
35 }}
catapult::predicate
std::function< bool(TArgs...)> predicate
A predicate function.
Definition: functions.h:31
catapult::utils::map_erase_if
void map_erase_if(TMap &map, TPredicate predicate)
Removes all entries from map that fulfill the given predicate.
Definition: ContainerHelpers.h:27
catapult
Definition: AddressExtractionExtension.cpp:28