mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +00:00
[C++] Add option to not generate direct copy methods. (#6166)
* Add option to not generate direct copy methods. The direct copy methods generated by flatc utilize std::vector which isn't allowed on some embedded systems. Permit users of the compiler to not generate these methods so they don't have to be stubbed out. * Update docs for no-cpp-direct-copy option.
This commit is contained in:
@@ -2398,7 +2398,7 @@ class CppGenerator : public BaseGenerator {
|
||||
}
|
||||
|
||||
// Generate a CreateXDirect function with vector types as parameters
|
||||
if (has_string_or_vector_fields) {
|
||||
if (opts_.cpp_direct_copy && has_string_or_vector_fields) {
|
||||
code_ +=
|
||||
"inline flatbuffers::Offset<{{STRUCT_NAME}}> "
|
||||
"Create{{STRUCT_NAME}}Direct(";
|
||||
|
||||
Reference in New Issue
Block a user