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

Function SafeCopy

cpp/src/arrow/util/ubsan.h:78–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76
77template <typename U, typename T>
78inline std::enable_if_t<std::is_trivially_copyable_v<T> &&
79 std::is_trivially_copyable_v<U> && sizeof(T) == sizeof(U),
80 U>
81SafeCopy(T value) {
82 using TypeU = std::remove_const_t<U>;
83 arrow::internal::AlignedStorage<TypeU> raw_data;
84 std::memcpy(raw_data.get(), static_cast<const void*>(&value), sizeof(T));
85 auto data = *raw_data.get();
86 raw_data.destroy();
87 return data;
88}
89
90template <typename T>
91inline std::enable_if_t<std::is_trivially_copyable_v<T>, void> SafeStore(void* unaligned,

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected