diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 1a250cd73..9ceb2c3ee 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -1653,8 +1653,9 @@ class FlatBufferBuilder { Offset> CreateVectorOfNativeStructs(const S *v, size_t len) { extern T Pack(const S &); + typedef T (*Pack_t)(const S &); std::vector vv(len); - std::transform(v, v + len, vv.begin(), Pack); + std::transform(v, v + len, vv.begin(), static_cast(&Pack)); return CreateVectorOfStructs(vv.data(), vv.size()); } @@ -1792,8 +1793,8 @@ class FlatBufferBuilder { extern T Pack(const S &); typedef T (*Pack_t)(const S &); std::vector vv(len); - std::transform(v, v + len, vv.begin(), static_cast(Pack)); - return CreateVectorOfSortedStructs(vv, len); + std::transform(v, v + len, vv.begin(), static_cast(&Pack)); + return CreateVectorOfSortedStructs(vv.data(), vv.size()); } /// @cond FLATBUFFERS_INTERNAL