MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / tryCopyTo

Method tryCopyTo

include/cpp/marshal/View.hpp:11–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10template<class T>
11inline bool cpp::marshal::View<T>::tryCopyTo(const View<T>& destination) const
12{
13 if (destination.length < length)
14 {
15 return false;
16 }
17
18 if (ptr.ptr + length < destination.ptr.ptr || destination.ptr.ptr + length < ptr.ptr)
19 std::memcpy(destination.ptr.ptr, ptr.ptr, sizeof(T) * length);
20 else
21 std::memmove(destination.ptr.ptr, ptr.ptr, sizeof(T) * length);
22
23 return true;
24}
25
26template<class T>
27inline void cpp::marshal::View<T>::copyTo(const View<T>& destination) const

Callers 1

encodeMethod · 0.80

Calls 1

memcpyFunction · 0.85

Tested by

no test coverage detected