From f445c1eb4aa70b4717b4eb53bdd89c447359d3c2 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Mon, 5 Nov 2018 16:33:06 -0800 Subject: [PATCH] Fixed STLPort build Change-Id: I2b9508f547667695475be64fa56f64f129603fd4 --- src/idl_gen_cpp.cpp | 5 +++-- tests/monster_test_generated.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index 66fec8169..4c4cd43d3 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -2363,8 +2363,9 @@ class CppGenerator : public BaseGenerator { // the underlying storage type (eg. uint8_t). const auto basetype = GenTypeBasic( field.value.type.enum_def->underlying_type, false); - code += "_fbb.CreateVectorScalarCast<" + basetype + ">(" + value + - ".data(), " + value + ".size())"; + code += "_fbb.CreateVectorScalarCast<" + basetype + + ">(flatbuffers::data(" + value + "), " + value + + ".size())"; } else if (field.attributes.Lookup("cpp_type")) { auto type = GenTypeBasic(vector_type, false); code += "_fbb.CreateVector<" + type + ">(" + value + ".size(), "; diff --git a/tests/monster_test_generated.h b/tests/monster_test_generated.h index e378fa92f..bd3bfde36 100644 --- a/tests/monster_test_generated.h +++ b/tests/monster_test_generated.h @@ -2504,7 +2504,7 @@ inline flatbuffers::Offset CreateMonster(flatbuffers::FlatBufferBuilder auto _any_unique = _o->any_unique.Pack(_fbb); auto _any_ambiguous_type = _o->any_ambiguous.type; auto _any_ambiguous = _o->any_ambiguous.Pack(_fbb); - auto _vector_of_enums = _o->vector_of_enums.size() ? _fbb.CreateVectorScalarCast(_o->vector_of_enums.data(), _o->vector_of_enums.size()) : 0; + auto _vector_of_enums = _o->vector_of_enums.size() ? _fbb.CreateVectorScalarCast(flatbuffers::data(_o->vector_of_enums), _o->vector_of_enums.size()) : 0; return MyGame::Example::CreateMonster( _fbb, _pos,