[C++] Restore version with correct static_cast, add the same fix for SortedStructs
This commit is contained in:
parent
34580df089
commit
d61f4d6628
|
@ -1653,8 +1653,9 @@ class FlatBufferBuilder {
|
||||||
Offset<Vector<const T *>> CreateVectorOfNativeStructs(const S *v,
|
Offset<Vector<const T *>> CreateVectorOfNativeStructs(const S *v,
|
||||||
size_t len) {
|
size_t len) {
|
||||||
extern T Pack(const S &);
|
extern T Pack(const S &);
|
||||||
|
typedef T (*Pack_t)(const S &);
|
||||||
std::vector<T> vv(len);
|
std::vector<T> vv(len);
|
||||||
std::transform(v, v + len, vv.begin(), Pack);
|
std::transform(v, v + len, vv.begin(), static_cast<Pack_t>(&Pack));
|
||||||
return CreateVectorOfStructs<T>(vv.data(), vv.size());
|
return CreateVectorOfStructs<T>(vv.data(), vv.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1792,8 +1793,8 @@ class FlatBufferBuilder {
|
||||||
extern T Pack(const S &);
|
extern T Pack(const S &);
|
||||||
typedef T (*Pack_t)(const S &);
|
typedef T (*Pack_t)(const S &);
|
||||||
std::vector<T> vv(len);
|
std::vector<T> vv(len);
|
||||||
std::transform(v, v + len, vv.begin(), static_cast<Pack_t&>(Pack));
|
std::transform(v, v + len, vv.begin(), static_cast<Pack_t>(&Pack));
|
||||||
return CreateVectorOfSortedStructs<T>(vv, len);
|
return CreateVectorOfSortedStructs<T>(vv.data(), vv.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @cond FLATBUFFERS_INTERNAL
|
/// @cond FLATBUFFERS_INTERNAL
|
||||||
|
|
Loading…
Reference in New Issue