MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / CreateVector

Function CreateVector

native/thirdpart/flatbuffers/flatbuffers.h:1704–1724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1702 /// @return Returns a typed `Offset` into the serialized data indicating
1703 /// where the vector is stored.
1704 template<typename T> Offset<Vector<T>> CreateVector(const T *v, size_t len) {
1705 // If this assert hits, you're specifying a template argument that is
1706 // causing the wrong overload to be selected, remove it.
1707 AssertScalarT<T>();
1708 StartVector(len, sizeof(T));
1709 if (len == 0) { return Offset<Vector<T>>(EndVector(len)); }
1710 // clang-format off
1711 #if FLATBUFFERS_LITTLEENDIAN
1712 PushBytes(reinterpret_cast<const uint8_t *>(v), len * sizeof(T));
1713 #else
1714 if (sizeof(T) == 1) {
1715 PushBytes(reinterpret_cast<const uint8_t *>(v), len);
1716 } else {
1717 for (auto i = len; i > 0; ) {
1718 PushElement(v[--i]);
1719 }
1720 }
1721 #endif
1722 // clang-format on
1723 return Offset<Vector<T>>(EndVector(len));
1724 }
1725
1726 template<typename T>
1727 Offset<Vector<Offset<T>>> CreateVector(const Offset<T> *v, size_t len) {

Callers 2

CreateVectorOfStringsFunction · 0.70

Calls 6

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

Tested by

no test coverage detected