Remove copy constructor to make flatbuffers struct trivially copyable… (#4476)

* Remove copy constructor to make flatbuffers struct trivially copyable + add tests.

* Add support non c++11 compliant compilers.

* Fix std::trivially_copyiable test for non-C++11 compliant compilers.

* Fix trivially_copyable not part of glibc < 5 even with c++11 switch enabled.
This commit is contained in:
Louis-Paul CORDIER
2017-11-16 19:08:41 +01:00
committed by Wouter van Oortmerssen
parent e2c7196ea8
commit 853f7033e0
3 changed files with 15 additions and 14 deletions

View File

@@ -197,9 +197,6 @@ MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS {
Test() {
memset(this, 0, sizeof(Test));
}
Test(const Test &_o) {
memcpy(this, &_o, sizeof(Test));
}
Test(int16_t _a, int8_t _b)
: a_(flatbuffers::EndianScalar(_a)),
b_(flatbuffers::EndianScalar(_b)),
@@ -237,9 +234,6 @@ MANUALLY_ALIGNED_STRUCT(16) Vec3 FLATBUFFERS_FINAL_CLASS {
Vec3() {
memset(this, 0, sizeof(Vec3));
}
Vec3(const Vec3 &_o) {
memcpy(this, &_o, sizeof(Vec3));
}
Vec3(float _x, float _y, float _z, double _test1, Color _test2, const Test &_test3)
: x_(flatbuffers::EndianScalar(_x)),
y_(flatbuffers::EndianScalar(_y)),
@@ -302,9 +296,6 @@ MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS {
Ability() {
memset(this, 0, sizeof(Ability));
}
Ability(const Ability &_o) {
memcpy(this, &_o, sizeof(Ability));
}
Ability(uint32_t _id, uint32_t _distance)
: id_(flatbuffers::EndianScalar(_id)),
distance_(flatbuffers::EndianScalar(_distance)) {