Flutter Engine
Loading...
Searching...
No Matches
container_utils.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 BASE_CONTAINER_UTILS_H_
6
#define BASE_CONTAINER_UTILS_H_
7
8
#include <algorithm>
9
#include <set>
10
#include <vector>
11
12
namespace
base
{
13
14
template
<
class
T,
class
Allocator,
class
Predicate>
15
size_t
EraseIf
(std::vector<T, Allocator>& container, Predicate pred) {
16
auto
it = std::remove_if(container.begin(), container.end(), pred);
17
size_t
removed = std::distance(it, container.end());
18
container.erase(it, container.end());
19
return
removed;
20
}
21
22
template
<
typename
Container,
typename
Value>
23
bool
Contains
(
const
Container& container,
const
Value& value) {
24
return
container.find(
value
) != container.end();
25
}
26
27
template
<
typename
T>
28
bool
Contains
(
const
std::vector<T>& container,
const
T& value) {
29
return
std::find(container.begin(), container.end(),
value
) !=
30
container.end();
31
}
32
33
}
// namespace base
34
35
#endif
// BASE_CONTAINER_UTILS_H_
value
int32_t value
Definition
dl_golden_unittests.cc:459
base
Definition
ax_tree_id_registry.h:17
base::EraseIf
size_t EraseIf(std::vector< T, Allocator > &container, Predicate pred)
Definition
container_utils.h:15
base::Contains
bool Contains(const Container &container, const Value &value)
Definition
container_utils.h:23
third_party
accessibility
base
container_utils.h
Generated on Wed Nov 5 2025 21:33:19 for Flutter Engine by
1.9.8