From b0fd1a8c66a58c3749d50fe4379b4bcffcfb6514 Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 13 Oct 2017 16:21:34 -0700 Subject: [PATCH] Use flatbuffer unique_ptr instead of std's. Stlport does not have std unique_ptr, so using the one provided by flatbuffers. Also fixing a problem with the flatbuffer unique_ptr, and a test. --- include/flatbuffers/idl.h | 2 +- include/flatbuffers/stl_emulation.h | 2 +- tests/test.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h index dac254353..b55e51b89 100644 --- a/include/flatbuffers/idl.h +++ b/include/flatbuffers/idl.h @@ -284,7 +284,7 @@ struct StructDef : public Definition { size_t minalign; // What the whole object needs to be aligned to. size_t bytesize; // Size if fixed. - std::unique_ptr original_location; + flatbuffers::unique_ptr original_location; }; inline bool IsStruct(const Type &type) { diff --git a/include/flatbuffers/stl_emulation.h b/include/flatbuffers/stl_emulation.h index c025eca1a..16d35f2e9 100644 --- a/include/flatbuffers/stl_emulation.h +++ b/include/flatbuffers/stl_emulation.h @@ -170,7 +170,7 @@ inline void vector_emplace_back(std::vector *vector, V &&data) { return *this; } - const T& operator*() const { return ptr_; } + const T& operator*() const { return *ptr_; } T* operator->() const { return ptr_; } T* get() const noexcept { return ptr_; } explicit operator bool() const { return ptr_ != nullptr; } diff --git a/tests/test.cpp b/tests/test.cpp index 042994369..fb20d75ef 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -1661,7 +1661,7 @@ void FlexBuffersTest() { int ints[] = { 1, 2, 3 }; slb2.Vector("bar", ints, 3); slb2.FixedTypedVector("bar3", ints, 3); - slb.Bool("bool", true); + slb2.Bool("bool", true); slb2.Double("foo", 100); slb2.Map("mymap", [](flexbuffers::Builder& slb3) { slb3.String("foo", "Fred"); // Testing key and string reuse.