Flutter Engine
 
Loading...
Searching...
No Matches
container.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_FML_CONTAINER_H_
6#define FLUTTER_FML_CONTAINER_H_
7
8#include <functional>
9#include <map>
10
11namespace fml {
12
13template <
14 class Collection =
15 std::unordered_map<class Key, class Value, class Hash, class Equal>>
17 Collection& container,
18 const std::function<bool(typename Collection::iterator)>& predicate) {
19 auto it = container.begin();
20 while (it != container.end()) {
21 if (predicate(it)) {
22 it = container.erase(it);
23 continue;
24 }
25 it++;
26 }
27}
28
29} // namespace fml
30
31#endif // FLUTTER_FML_CONTAINER_H_
void erase_if(Collection &container, const std::function< bool(typename Collection::iterator)> &predicate)
Definition container.h:16