this is allow custom allocator for obj-api structs/tables. (#4520)
added "native_custom_alloc" attribute to tables/structs, eg. table parent_table( native_custom_alloc:"custom_alloc_name" ) { ... } with a custom allocator defined as template <typename T> class custom_alloc_name : public std::allocator<T> { public: typedef T* pointer; template <class U> struct rebind { typedef custom_alloc_name<U> other; }; pointer allocate(const std::size_t n) { return ....; } void deallocate(T* ptr, std::size_t n) { ... } custom_alloc_name() throw() {} template <class U> custom_alloc_name(const custom_alloc_name<U>&) throw() {} }; };
Showing
- docs/source/CppUsage.md 39 additions, 0 deletionsdocs/source/CppUsage.md
- include/flatbuffers/flatbuffers.h 4 additions, 4 deletionsinclude/flatbuffers/flatbuffers.h
- include/flatbuffers/idl.h 1 addition, 0 deletionsinclude/flatbuffers/idl.h
- src/idl_gen_cpp.cpp 19 additions, 1 deletionsrc/idl_gen_cpp.cpp
- src/idl_parser.cpp 4 additions, 0 deletionssrc/idl_parser.cpp
- tests/monster_test.bfbs 0 additions, 0 deletionstests/monster_test.bfbs
- tests/namespace_test/namespace_test2_generated.ts 10 additions, 10 deletionstests/namespace_test/namespace_test2_generated.ts
Loading
Please register or sign in to comment