VS fix for ambiguous union assignment operator.

Change-Id: I1c37db1ced462fd558d3e893a501341f3eca6379
This commit is contained in:
Wouter van Oortmerssen 2017-04-17 18:00:41 -07:00
parent 46497e4f9a
commit 523f3833eb
4 changed files with 8 additions and 8 deletions

View File

@ -78,8 +78,8 @@ struct EquipmentUnion {
type(Equipment_NONE), value(nullptr)
{ std::swap(type, u.type); std::swap(value, u.value); }
EquipmentUnion(const EquipmentUnion &) FLATBUFFERS_NOEXCEPT;
EquipmentUnion &operator=(EquipmentUnion u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
EquipmentUnion &operator=(const EquipmentUnion &u) FLATBUFFERS_NOEXCEPT
{ EquipmentUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
EquipmentUnion &operator=(EquipmentUnion &&u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
~EquipmentUnion() { Reset(); }

View File

@ -688,8 +688,8 @@ class CppGenerator : public BaseGenerator {
code_ += " type({{NONE}}), value(nullptr)";
code_ += " { std::swap(type, u.type); std::swap(value, u.value); }";
code_ += " {{NAME}}Union(const {{NAME}}Union &) FLATBUFFERS_NOEXCEPT;";
code_ += " {{NAME}}Union &operator=({{NAME}}Union u) FLATBUFFERS_NOEXCEPT";
code_ += " { std::swap(type, u.type); std::swap(value, u.value); return *this; }";
code_ += " {{NAME}}Union &operator=(const {{NAME}}Union &u) FLATBUFFERS_NOEXCEPT";
code_ += " { {{NAME}}Union t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }";
code_ += " {{NAME}}Union &operator=({{NAME}}Union &&u) FLATBUFFERS_NOEXCEPT";
code_ += " { std::swap(type, u.type); std::swap(value, u.value); return *this; }";
code_ += " ~{{NAME}}Union() { Reset(); }";

View File

@ -109,8 +109,8 @@ struct AnyUnion {
type(Any_NONE), value(nullptr)
{ std::swap(type, u.type); std::swap(value, u.value); }
AnyUnion(const AnyUnion &) FLATBUFFERS_NOEXCEPT;
AnyUnion &operator=(AnyUnion u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
AnyUnion &operator=(const AnyUnion &u) FLATBUFFERS_NOEXCEPT
{ AnyUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
AnyUnion &operator=(AnyUnion &&u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
~AnyUnion() { Reset(); }

View File

@ -56,8 +56,8 @@ struct CharacterUnion {
type(Character_NONE), value(nullptr)
{ std::swap(type, u.type); std::swap(value, u.value); }
CharacterUnion(const CharacterUnion &) FLATBUFFERS_NOEXCEPT;
CharacterUnion &operator=(CharacterUnion u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
CharacterUnion &operator=(const CharacterUnion &u) FLATBUFFERS_NOEXCEPT
{ CharacterUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
CharacterUnion &operator=(CharacterUnion &&u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; }
~CharacterUnion() { Reset(); }