From 6f4b4c80a71a6e31bc16a53751ab122317eacf8a Mon Sep 17 00:00:00 2001 From: dyu Date: Sat, 27 Dec 2014 21:30:26 +0800 Subject: [PATCH] non-generic version of CreateUninitializedVector for c ffi Change-Id: Id7618e53797a158b82e7e480a6507887db3528bc --- include/flatbuffers/flatbuffers.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 7b72319df..e1999f90a 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -649,11 +649,15 @@ class FlatBufferBuilder FLATBUFFERS_FINAL_CLASS { // Specialized version for non-copying use cases. Data to be written later. // After calling this function, GetBufferPointer() can be cast to the // corresponding Vector<> type to write the data (through Data()). - template Offset> CreateUninitializedVector(size_t len) { + uoffset_t CreateUninitializedVector(size_t len, size_t elemsize) { NotNested(); - StartVector(len, sizeof(T)); - buf_.make_space(len * sizeof(T)); - return Offset>(EndVector(len)); + StartVector(len, elemsize); + buf_.make_space(len * elemsize); + return EndVector(len); + } + + template Offset> CreateUninitializedVector(size_t len) { + return CreateUninitializedVector(len, sizeof(T)); } template Offset> CreateVector(const std::vector &v){