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

@@ -2284,11 +2284,6 @@ class CppGenerator : public BaseGenerator {
code_ += " memset(this, 0, sizeof({{STRUCT_NAME}}));";
code_ += " }";
// Generate a copy constructor.
code_ += " {{STRUCT_NAME}}(const {{STRUCT_NAME}} &_o) {";
code_ += " memcpy(this, &_o, sizeof({{STRUCT_NAME}}));";
code_ += " }";
// Generate a constructor that takes all fields as arguments.
std::string arg_list;
std::string init_list;