Relinquish the pointer to the caller.
| 970 | |
| 971 | // Relinquish the pointer to the caller. |
| 972 | DetachedBuffer release() { |
| 973 | // allocator ownership (if any) is transferred to DetachedBuffer. |
| 974 | DetachedBuffer fb(allocator_, own_allocator_, buf_, reserved_, cur_, |
| 975 | size()); |
| 976 | if (own_allocator_) { |
| 977 | allocator_ = nullptr; |
| 978 | own_allocator_ = false; |
| 979 | } |
| 980 | buf_ = nullptr; |
| 981 | clear(); |
| 982 | return fb; |
| 983 | } |
| 984 | |
| 985 | size_t ensure_space(size_t len) { |
| 986 | FLATBUFFERS_ASSERT(cur_ >= scratch_ && scratch_ >= buf_); |