[C++]Use noexcept in union type move ctor/Add move assingment (#4249)

* Use noexcept in union type move ctor/Add move assingment

* Add NOEXCEPT macro to deal with _MS_VER/Remove delegating ctor in union type class

* Add FLATBUFFERS_NOEXCEPT to generated union class
This commit is contained in:
moti
2017-03-30 10:00:20 +09:00
committed by Wouter van Oortmerssen
parent 238a8ebb15
commit 2aec880347
4 changed files with 16 additions and 3 deletions

View File

@@ -74,11 +74,13 @@ struct EquipmentUnion {
flatbuffers::NativeTable *table;
EquipmentUnion() : type(Equipment_NONE), table(nullptr) {}
EquipmentUnion(EquipmentUnion&& u):
EquipmentUnion(EquipmentUnion&& u) FLATBUFFERS_NOEXCEPT :
type(Equipment_NONE), table(nullptr)
{ std::swap(type, u.type); std::swap(table, u.table); }
EquipmentUnion(const EquipmentUnion &);
EquipmentUnion &operator=(const EquipmentUnion &);
EquipmentUnion &operator=(EquipmentUnion &&u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(table, u.table); return *this; }
~EquipmentUnion() { Reset(); }
void Reset();