From a9514de978718c5c5af16e12427d52d4d90281a6 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen <aardappel@gmail.com> Date: Wed, 8 Feb 2017 15:59:52 -0800 Subject: [PATCH] Fixed vector test on Windows --- include/flatbuffers/flexbuffers.h | 5 +++++ tests/test.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index d588fa40..242a5365 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -946,6 +946,11 @@ class Builder FLATBUFFERS_FINAL_CLASS { EndVector(start, false, false); } } + template<typename T> void Vector(const char *key, const T *elems, + size_t len) { + Key(key); + Vector(elems, len); + } template<typename T> void Vector(const std::vector<T> &vec) { Vector(vec.data(), vec.size()); } diff --git a/tests/test.cpp b/tests/test.cpp index 106a4792..f74e9a8b 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -1373,8 +1373,8 @@ void FlexBuffersTest() { slb.IndirectFloat(4.0f); }); int ints[] = { 1, 2, 3 }; - slb.Add("bar", ints); - slb.FixedTypedVector("bar3", ints, sizeof(ints) / sizeof(int)); + slb.Vector("bar", ints, 3); + slb.FixedTypedVector("bar3", ints, 3); slb.Double("foo", 100); slb.Map("mymap", [&]() { slb.String("foo", "Fred"); // Testing key and string reuse. -- GitLab