diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index c4dc5bc..c090455 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -1861,14 +1861,14 @@ class FlatBufferBuilder { /// @cond FLATBUFFERS_INTERNAL template struct TableKeyComparator { - TableKeyComparator(vector_downward &buf) : buf_(buf) {} + TableKeyComparator(vector_downward &buf) : buf_(&buf) {} TableKeyComparator(const TableKeyComparator &other) : buf_(other.buf_) {} bool operator()(const Offset &a, const Offset &b) const { - auto table_a = reinterpret_cast(buf_.data_at(a.o)); - auto table_b = reinterpret_cast(buf_.data_at(b.o)); + auto table_a = reinterpret_cast(buf_->data_at(a.o)); + auto table_b = reinterpret_cast(buf_->data_at(b.o)); return table_a->KeyCompareLessThan(table_b); } - vector_downward &buf_; + vector_downward *buf_; private: TableKeyComparator &operator=(const TableKeyComparator &other) {