• Lawrence Chan's avatar
    [C++] Improve Allocator handling (#4312) · fb87c0d3
    Lawrence Chan authored
    * Improve Allocator handling
    
    - Templatize Allocator on vector_downward, and make it own the allocator
    instance so it can manage lifetimes.
    - Templatize + rename FlatBufferBuilderT accordingly, and add a typedef
    to FlatBufferBuilder so old code continues to work.
    - Fix some issues with the release deleter
    - More details in github issue #4311
    
    * Fix constexpr for older MSVC
    
    * Reimplement allocator improvements via inheritance
    
    Instead of templates, use an abstract base class and some unique_ptrs to
    implement the new and improved allocator.
    
    * Fix misplaced newline
    
    * Add missing override keyword
    
    * Add macro for func delete to support older compilers
    
    * Explicitly move BufferDeleter (maybe fixes VS 10?)
    
    * Revert previous attempt at VS10 fix
    
    * Try yet another workaround for MS 10
    
    * Use FLATBUFFERS_NOEXCEPT macro
    
    * Add FLATBUFFERS_OVERRIDE macro
    
    * Fix some issues with MSVC 16 hack
    
    * Remove dep on unique_ptr
    
    * Update DEPRECATED macro with a message
    
    * Sigh, no delegating ctors before c++11
    
    * Fix simple_allocator stub
    
    * Relax FlatBufferBuilder ctor
    
    * Add vector_downward reset + assert in clear
    
    * Rename DetachedBuffer to FlatBuffer + remove unnecessary deprecations
    
    * Add flatbuffers::FlatBufferBuilder::Release()
    
    * Address remaining allocator-improvements comments
    fb87c0d3
test.cpp 59.6 KB