Jason Simmons f45a8f8b71
Roll Clang to 8c7a2ce01a77c96028fe2c8566f65c45ad9408d3 (#173429)
This version is currently used by Dart.
2025-08-12 17:21:53 +00:00

32 lines
733 B
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_FML_CONTAINER_H_
#define FLUTTER_FML_CONTAINER_H_
#include <functional>
#include <map>
namespace fml {
template <
class Collection =
std::unordered_map<class Key, class Value, class Hash, class Equal>>
void erase_if(
Collection& container,
const std::function<bool(typename Collection::iterator)>& predicate) {
auto it = container.begin();
while (it != container.end()) {
if (predicate(it)) {
it = container.erase(it);
continue;
}
it++;
}
}
} // namespace fml
#endif // FLUTTER_FML_CONTAINER_H_