diff options
author | Wouter van Oortmerssen <wvo@google.com> | 2015-09-14 11:00:12 -0700 |
---|---|---|
committer | Wouter van Oortmerssen <wvo@google.com> | 2015-09-14 11:00:12 -0700 |
commit | af1487bcfb1c223d6eb58bb6c1426e00197d55ed (patch) | |
tree | 3757446fa47efd769b6efb96bc4eed5e270cf367 /docs/source/CppUsage.md | |
parent | 5db12e9907e52bdbee9af5725df166eeda184a06 (diff) | |
download | flatbuffers-af1487bcfb1c223d6eb58bb6c1426e00197d55ed.tar.gz flatbuffers-af1487bcfb1c223d6eb58bb6c1426e00197d55ed.tar.bz2 flatbuffers-af1487bcfb1c223d6eb58bb6c1426e00197d55ed.zip |
Clarified use of unions in C++.
Change-Id: I9654e0c6a45457c8e150f07dd5f7b39539266f9e
Diffstat (limited to 'docs/source/CppUsage.md')
-rwxr-xr-x | docs/source/CppUsage.md | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/source/CppUsage.md b/docs/source/CppUsage.md index 0786dcbf..31619e9d 100755 --- a/docs/source/CppUsage.md +++ b/docs/source/CppUsage.md @@ -72,7 +72,9 @@ since they won't bloat up the buffer sizes if they're not actually used. We do something similarly for the union field `test` by specifying a `0` offset and the `NONE` enum value (part of every union) to indicate we don't actually want to write this field. You can use `0` also as a default for other -non-scalar types, such as strings, vectors and tables. +non-scalar types, such as strings, vectors and tables. To pass an actual +table, pass a preconstructed table as `mytable.Union()` that corresponds to +union enum you're passing. Tables (like `Monster`) give you full flexibility on what fields you write (unlike `Vec3`, which always has all fields set because it is a `struct`). |