MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / CreateVector

Function CreateVector

Libs/flatbuffers/flatbuffers.h:1784–1804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1782 /// @return Returns a typed `Offset` into the serialized data indicating
1783 /// where the vector is stored.
1784 template<typename T> Offset<Vector<T>> CreateVector(const T *v, size_t len) {
1785 // If this assert hits, you're specifying a template argument that is
1786 // causing the wrong overload to be selected, remove it.
1787 AssertScalarT<T>();
1788 StartVector(len, sizeof(T));
1789 if (len == 0) { return Offset<Vector<T>>(EndVector(len)); }
1790 // clang-format off
1791 #if FLATBUFFERS_LITTLEENDIAN
1792 PushBytes(reinterpret_cast<const uint8_t *>(v), len * sizeof(T));
1793 #else
1794 if (sizeof(T) == 1) {
1795 PushBytes(reinterpret_cast<const uint8_t *>(v), len);
1796 } else {
1797 for (auto i = len; i > 0; ) {
1798 PushElement(v[--i]);
1799 }
1800 }
1801 #endif
1802 // clang-format on
1803 return Offset<Vector<T>>(EndVector(len));
1804 }
1805
1806 template<typename T>
1807 Offset<Vector<Offset<T>>> CreateVector(const Offset<T> *v, size_t len) {

Callers 1

Calls 6

PushBytesFunction · 0.85
PushElementFunction · 0.85
StartVectorFunction · 0.70
EndVectorFunction · 0.70
dataFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected