[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

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