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