Enforcing CreateUninitializedVector is only used with scalars.

This function cannot work with any offset types (since offsets
must always point forward) so this avoid possible mistakes.

Change-Id: I1b3dfbefc8d40da630345b9b04f9aff4a990e8e5
parent c7a797b9
...@@ -1540,6 +1540,7 @@ class FlatBufferBuilder { ...@@ -1540,6 +1540,7 @@ class FlatBufferBuilder {
/// in the buffer. /// in the buffer.
template<typename T> template<typename T>
Offset<Vector<T>> CreateUninitializedVector(size_t len, T **buf) { Offset<Vector<T>> CreateUninitializedVector(size_t len, T **buf) {
AssertScalarT<T>();
return CreateUninitializedVector(len, sizeof(T), return CreateUninitializedVector(len, sizeof(T),
reinterpret_cast<uint8_t **>(buf)); reinterpret_cast<uint8_t **>(buf));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment