summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2019-04-11 14:18:21 -0700
committerWouter van Oortmerssen <aardappel@gmail.com>2019-04-11 14:18:21 -0700
commit640df2c1f572ddcbab036c94609fd33ab21bab64 (patch)
tree1e1785ef9e0468efaa8c5fbb78f111655ffe8734 /samples
parent60340ac529731bbf95b0d9359a58d26738ca2cef (diff)
downloadflatbuffers-640df2c1f572ddcbab036c94609fd33ab21bab64.tar.gz
flatbuffers-640df2c1f572ddcbab036c94609fd33ab21bab64.tar.bz2
flatbuffers-640df2c1f572ddcbab036c94609fd33ab21bab64.zip
Allow Set() methods to handle reference types
Change-Id: I487ded77d28490189dd5d38236cb04bffaf5f11a
Diffstat (limited to 'samples')
-rw-r--r--samples/monster_generated.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/samples/monster_generated.h b/samples/monster_generated.h
index e89ec3a5..d9d64793 100644
--- a/samples/monster_generated.h
+++ b/samples/monster_generated.h
@@ -119,12 +119,12 @@ struct EquipmentUnion {
void Reset();
#ifndef FLATBUFFERS_CPP98_STL
- template <typename T>
+ template <typename T, typename RT = typename std::remove_reference<T>::type>
void Set(T&& val) {
Reset();
- type = EquipmentTraits<typename T::TableType>::enum_value;
+ type = EquipmentTraits<typename RT::TableType>::enum_value;
if (type != Equipment_NONE) {
- value = new T(std::forward<T>(val));
+ value = new RT(std::forward<T>(val));
}
}
#endif // FLATBUFFERS_CPP98_STL