diff options
author | endorph-soft <endorph@endorph.net> | 2017-09-22 06:36:20 +0930 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2017-09-21 14:06:20 -0700 |
commit | 21a81219820f4acc1e50569ff280b24b1af29a36 (patch) | |
tree | 2c49c573c00f8b808794e1f66f610775f5c8e83b /samples | |
parent | 28920aff8f4f1c050f30cc069ed26a69fd335815 (diff) | |
download | flatbuffers-21a81219820f4acc1e50569ff280b24b1af29a36.tar.gz flatbuffers-21a81219820f4acc1e50569ff280b24b1af29a36.tar.bz2 flatbuffers-21a81219820f4acc1e50569ff280b24b1af29a36.zip |
Add constant accessors to C++ unions (#4433)
* Add constant accessors to C++ unions
* Remove redundant const pointer return type
* Update generate_code.bat to reflect generate_code.sh
* Add updated generated files
* Remove extra space from generated code
* Update generated files
* Change directory back to tests after generating code
Diffstat (limited to 'samples')
-rw-r--r-- | samples/monster_generated.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/samples/monster_generated.h b/samples/monster_generated.h index 2f3141bb..523a136b 100644 --- a/samples/monster_generated.h +++ b/samples/monster_generated.h @@ -121,6 +121,10 @@ struct EquipmentUnion { return type == Equipment_Weapon ? reinterpret_cast<WeaponT *>(value) : nullptr; } + const WeaponT *AsWeapon() const { + return type == Equipment_Weapon ? + reinterpret_cast<const WeaponT *>(value) : nullptr; + } }; bool VerifyEquipment(flatbuffers::Verifier &verifier, const void *obj, Equipment type); |