From 7f2a1c90d5ac142d1f9230fc32aa455781681aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 13 Mar 2017 16:53:30 +0100 Subject: [PATCH] Prevent flatbuffers::Vector and flatbuffers::VectorOfAny to be copied (#4217) --- include/flatbuffers/flatbuffers.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 138f90175..ce657c04e 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -441,6 +441,10 @@ protected: uoffset_t length_; private: + // This class is a pointer. Copying will therefore create an invalid object. + // Private and unimplemented copy constructor. + Vector(const Vector&); + template static int KeyCompare(const void *ap, const void *bp) { const K *key = reinterpret_cast(ap); const uint8_t *data = reinterpret_cast(bp); @@ -468,6 +472,9 @@ protected: VectorOfAny(); uoffset_t length_; + +private: + VectorOfAny(const VectorOfAny&); }; // Convenient helper function to get the length of any vector, regardless