mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-05 13:08:58 +00:00
Support attribute "cpp_ptr_type" on table elements marked as "hash" (#4643)
* added intended use-cases to monster_test.fbs * added check for `cpp_ptr_type` on hashed fields added default value 'naked' to `cpp_ptr_type` on hashed fields * added C++ generation of cpp_type vectors removed ctor call for vector fields added condition !vector for cpp_type check added Pack() and UnPack() code generation for vector of hashes added generation of correct resolve/rehash for cpp_type elements * added attribute 'cpp_ptr_type_get' to hold accessor for pointer types possible where '.get()' does not work use case: cpp_ptr_type:"std::weak_ptr", cpp_ptr_type_get:".lock().get()" * run flatc to re-generate headers * added bool param is_ctor to GetDefaultScalarValue() to differentiate between usage places * modified monster_test.fbs to remove usage of shared_ptr/weak_ptr reason: STLport does not support std::shared_ptr and std::weak_ptr * run flatc again to re-generate headers * fixed symbol unique_ptr not in namespace std when building with STLport
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
4ea1be53d4
commit
9ce98dd77d
@@ -20,6 +20,15 @@
|
||||
#include "flatbuffers/registry.h"
|
||||
#include "flatbuffers/util.h"
|
||||
|
||||
// clang-format off
|
||||
#ifdef FLATBUFFERS_CPP98_STL
|
||||
#include "flatbuffers/stl_emulation.h"
|
||||
namespace std {
|
||||
using flatbuffers::unique_ptr;
|
||||
}
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
#include "monster_test_generated.h"
|
||||
#include "namespace_test/namespace_test1_generated.h"
|
||||
#include "namespace_test/namespace_test2_generated.h"
|
||||
|
||||
Reference in New Issue
Block a user