diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2017-04-10 15:56:51 -0700 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2017-04-12 17:47:47 -0700 |
commit | b0752e179bdbae516125cccacd7aebcfd83033a9 (patch) | |
tree | 02452e310add4d052b934dae617d1f81b3cefbcc /docs | |
parent | 1fc12e0e5b7782d584381ae74f2ec7bc520fb82a (diff) | |
download | flatbuffers-b0752e179bdbae516125cccacd7aebcfd83033a9.tar.gz |
Added support for structs and strings in unions.
(C++ only for now).
Also fixed vector of union support in the object API.
Bug: 36902939
Change-Id: I935f4cc2c303a4728e26c7916a8ec0adcd6f84cb
Tested: on Linux.
Diffstat (limited to 'docs')
-rwxr-xr-x | docs/source/CppUsage.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/source/CppUsage.md b/docs/source/CppUsage.md index 0e226fc7..cff3071b 100755 --- a/docs/source/CppUsage.md +++ b/docs/source/CppUsage.md @@ -411,4 +411,22 @@ manually wrap it in synchronisation primites. There's no automatic way to accomplish this, by design, as we feel multithreaded construction of a single buffer will be rare, and synchronisation overhead would be costly. +## Advanced union features + +The C++ implementation currently supports vectors of unions (i.e. you can +declare a field as `[T]` where `T` is a union type instead of a table type). It +also supports structs and strings in unions, besides tables. + +For an example of these features, see `tests/union_vector`, and +`UnionVectorTest` in `test.cpp`. + +Since these features haven't been ported to other languages yet, if you +choose to use them, you won't be able to use these buffers in other languages +(`flatc` will refuse to compile a schema that uses these features). + +These features reduce the amount of "table wrapping" that was previously +needed to use unions. + +To use scalars, simply wrap them in a struct. + <br> |