diff --git a/samples/monster_generated.h b/samples/monster_generated.h index e835a7da6..48ca9818d 100644 --- a/samples/monster_generated.h +++ b/samples/monster_generated.h @@ -224,6 +224,10 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { const void *equipped() const { return GetPointer(VT_EQUIPPED); } + template const T *equipped_as() const; + const Weapon *equipped_as_Weapon() const { + return (equipped_type() == Equipment_Weapon)? static_cast(equipped()) : nullptr; + } void *mutable_equipped() { return GetPointer(VT_EQUIPPED); } @@ -250,6 +254,10 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); }; +template<> inline const Weapon *Monster::equipped_as() const { + return equipped_as_Weapon(); +} + struct MonsterBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_;