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

Function FromVector

cpp/src/arrow/buffer.h:217–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215 /// \return a new Buffer instance
216 template <typename T>
217 static std::shared_ptr<Buffer> FromVector(std::vector<T> vec) {
218 static_assert(std::is_trivial_v<T>,
219 "Buffer::FromVector can only wrap vectors of trivial objects");
220
221 if (vec.empty()) {
222 return std::shared_ptr<Buffer>{new Buffer()};
223 }
224
225 auto size_in_bytes = static_cast<int64_t>(vec.size() * sizeof(T));
226 return TakeOwnership(std::move(vec), size_in_bytes);
227 }
228
229 /// \brief Create buffer referencing typed memory with some length without
230 /// copying

Callers 6

TEST_FFunction · 0.85
MakeBinaryViewArrayFunction · 0.85
SetUpMethod · 0.85
TESTFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.85

Calls 3

TakeOwnershipFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by 6

TEST_FFunction · 0.68
MakeBinaryViewArrayFunction · 0.68
SetUpMethod · 0.68
TESTFunction · 0.68
ASSERT_OK_AND_ASSIGNFunction · 0.68