MCPcopy Create free account
hub / github.com/apache/arrow / ReplaceVectorElement

Function ReplaceVectorElement

cpp/src/arrow/util/vector.h:64–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62
63template <typename T>
64std::vector<T> ReplaceVectorElement(const std::vector<T>& values, size_t index,
65 T new_element) {
66 ARROW_DCHECK_LE(index, values.size());
67 std::vector<T> out;
68 out.reserve(values.size());
69 for (size_t i = 0; i < index; ++i) {
70 out.push_back(values[i]);
71 }
72 out.emplace_back(std::move(new_element));
73 for (size_t i = index + 1; i < values.size(); ++i) {
74 out.push_back(values[i]);
75 }
76 return out;
77}
78
79template <typename T, typename Predicate>
80std::vector<T> FilterVector(std::vector<T> values, Predicate&& predicate) {

Callers 3

SetColumnMethod · 0.85
SetFieldMethod · 0.85
SetColumnMethod · 0.85

Calls 4

push_backMethod · 0.80
emplace_backMethod · 0.80
sizeMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected