diff options
author | gregoire-astruc <gregoire.astruc@gmail.com> | 2015-02-24 13:14:46 +0100 |
---|---|---|
committer | Wouter van Oortmerssen <wvo@google.com> | 2015-03-11 17:27:38 -0700 |
commit | a360958be3f998b66e12a2d3db0ea17a05a37757 (patch) | |
tree | d7d50c9a8c490e45977341d185028fb457f9e900 /docs | |
parent | 432f3f26a40dbc51691c6d461d8a137c5e6c9f2e (diff) | |
download | flatbuffers-a360958be3f998b66e12a2d3db0ea17a05a37757.tar.gz |
Implementation of a buffer release strategy.
* Tests for Release feature.
* Check vector_downward.buf_ before passing to deallocator.
* Assertions.
* Shared test between unique_ptr and GetBufferPointer()
* Unnecessary using directives.
* Reallocate vector if released on clear operation.
* Use allocator attribute.
* Renamed `Release()` to `ReleaseBufferPointer()`
* For consistency with `GetBufferPointer()`
* Updated documentation for ReleaseBuffer.
Change-Id: I108527778e56ae5127abf9e5b1be6b445ad75cb7
Diffstat (limited to 'docs')
-rwxr-xr-x | docs/source/CppUsage.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/source/CppUsage.md b/docs/source/CppUsage.md index 3bd70697..ef7272ac 100755 --- a/docs/source/CppUsage.md +++ b/docs/source/CppUsage.md @@ -112,6 +112,12 @@ be compressed, or whatever you'd like to do with it. You can access the start of the buffer with `fbb.GetBufferPointer()`, and it's size from `fbb.GetSize()`. +Calling code may take ownership of the buffer with `fbb.ReleaseBufferPointer()`. +Should you do it, the `FlatBufferBuilder` will be in an invalid state, +and *must* be cleared before it can be used again. +However, it also means you are able to destroy the builder while keeping +the buffer in your application. + `samples/sample_binary.cpp` is a complete code sample similar to the code above, that also includes the reading code below. |