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

Function AddVectorElement

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

Source from the content-addressed store, hash-verified

46
47template <typename T>
48std::vector<T> AddVectorElement(const std::vector<T>& values, size_t index,
49 T new_element) {
50 ARROW_DCHECK_LE(index, values.size());
51 std::vector<T> out;
52 out.reserve(values.size() + 1);
53 for (size_t i = 0; i < index; ++i) {
54 out.push_back(values[i]);
55 }
56 out.emplace_back(std::move(new_element));
57 for (size_t i = index; i < values.size(); ++i) {
58 out.push_back(values[i]);
59 }
60 return out;
61}
62
63template <typename T>
64std::vector<T> ReplaceVectorElement(const std::vector<T>& values, size_t index,

Callers 4

AddColumnMethod · 0.85
AddFieldMethod · 0.85
AddColumnMethod · 0.85
TESTFunction · 0.85

Calls 4

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

Tested by 1

TESTFunction · 0.68