summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlexander Theißen <alex@theissen.io>2017-03-13 16:53:30 +0100
committerWouter van Oortmerssen <aardappel@gmail.com>2017-03-13 08:53:30 -0700
commit7f2a1c90d5ac142d1f9230fc32aa455781681aee (patch)
tree85fe073e62ee88a3b7977cd1d215f4ce075ee809 /include
parentf5387387def9c43956e369e7a256aab82e57e5c2 (diff)
downloadflatbuffers-7f2a1c90d5ac142d1f9230fc32aa455781681aee.tar.gz
flatbuffers-7f2a1c90d5ac142d1f9230fc32aa455781681aee.tar.bz2
flatbuffers-7f2a1c90d5ac142d1f9230fc32aa455781681aee.zip
Prevent flatbuffers::Vector and flatbuffers::VectorOfAny to be copied (#4217)
Diffstat (limited to 'include')
-rw-r--r--include/flatbuffers/flatbuffers.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h
index 138f9017..ce657c04 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<typename K> static int KeyCompare(const void *ap, const void *bp) {
const K *key = reinterpret_cast<const K *>(ap);
const uint8_t *data = reinterpret_cast<const uint8_t *>(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