VS fix for ambiguous union assignment operator.

Change-Id: I1c37db1ced462fd558d3e893a501341f3eca6379
parent 46497e4f
...@@ -78,8 +78,8 @@ struct EquipmentUnion { ...@@ -78,8 +78,8 @@ struct EquipmentUnion {
type(Equipment_NONE), value(nullptr) type(Equipment_NONE), value(nullptr)
{ std::swap(type, u.type); std::swap(value, u.value); } { std::swap(type, u.type); std::swap(value, u.value); }
EquipmentUnion(const EquipmentUnion &) FLATBUFFERS_NOEXCEPT; EquipmentUnion(const EquipmentUnion &) FLATBUFFERS_NOEXCEPT;
EquipmentUnion &operator=(EquipmentUnion u) FLATBUFFERS_NOEXCEPT EquipmentUnion &operator=(const EquipmentUnion &u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; } { EquipmentUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
EquipmentUnion &operator=(EquipmentUnion &&u) FLATBUFFERS_NOEXCEPT EquipmentUnion &operator=(EquipmentUnion &&u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; } { std::swap(type, u.type); std::swap(value, u.value); return *this; }
~EquipmentUnion() { Reset(); } ~EquipmentUnion() { Reset(); }
......
...@@ -688,8 +688,8 @@ class CppGenerator : public BaseGenerator { ...@@ -688,8 +688,8 @@ class CppGenerator : public BaseGenerator {
code_ += " type({{NONE}}), value(nullptr)"; code_ += " type({{NONE}}), value(nullptr)";
code_ += " { std::swap(type, u.type); std::swap(value, u.value); }"; code_ += " { std::swap(type, u.type); std::swap(value, u.value); }";
code_ += " {{NAME}}Union(const {{NAME}}Union &) FLATBUFFERS_NOEXCEPT;"; code_ += " {{NAME}}Union(const {{NAME}}Union &) FLATBUFFERS_NOEXCEPT;";
code_ += " {{NAME}}Union &operator=({{NAME}}Union u) FLATBUFFERS_NOEXCEPT"; code_ += " {{NAME}}Union &operator=(const {{NAME}}Union &u) FLATBUFFERS_NOEXCEPT";
code_ += " { std::swap(type, u.type); std::swap(value, u.value); return *this; }"; 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_ += " {{NAME}}Union &operator=({{NAME}}Union &&u) FLATBUFFERS_NOEXCEPT";
code_ += " { std::swap(type, u.type); std::swap(value, u.value); return *this; }"; code_ += " { std::swap(type, u.type); std::swap(value, u.value); return *this; }";
code_ += " ~{{NAME}}Union() { Reset(); }"; code_ += " ~{{NAME}}Union() { Reset(); }";
......
...@@ -109,8 +109,8 @@ struct AnyUnion { ...@@ -109,8 +109,8 @@ struct AnyUnion {
type(Any_NONE), value(nullptr) type(Any_NONE), value(nullptr)
{ std::swap(type, u.type); std::swap(value, u.value); } { std::swap(type, u.type); std::swap(value, u.value); }
AnyUnion(const AnyUnion &) FLATBUFFERS_NOEXCEPT; AnyUnion(const AnyUnion &) FLATBUFFERS_NOEXCEPT;
AnyUnion &operator=(AnyUnion u) FLATBUFFERS_NOEXCEPT AnyUnion &operator=(const AnyUnion &u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; } { AnyUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
AnyUnion &operator=(AnyUnion &&u) FLATBUFFERS_NOEXCEPT AnyUnion &operator=(AnyUnion &&u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; } { std::swap(type, u.type); std::swap(value, u.value); return *this; }
~AnyUnion() { Reset(); } ~AnyUnion() { Reset(); }
......
...@@ -56,8 +56,8 @@ struct CharacterUnion { ...@@ -56,8 +56,8 @@ struct CharacterUnion {
type(Character_NONE), value(nullptr) type(Character_NONE), value(nullptr)
{ std::swap(type, u.type); std::swap(value, u.value); } { std::swap(type, u.type); std::swap(value, u.value); }
CharacterUnion(const CharacterUnion &) FLATBUFFERS_NOEXCEPT; CharacterUnion(const CharacterUnion &) FLATBUFFERS_NOEXCEPT;
CharacterUnion &operator=(CharacterUnion u) FLATBUFFERS_NOEXCEPT CharacterUnion &operator=(const CharacterUnion &u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; } { CharacterUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
CharacterUnion &operator=(CharacterUnion &&u) FLATBUFFERS_NOEXCEPT CharacterUnion &operator=(CharacterUnion &&u) FLATBUFFERS_NOEXCEPT
{ std::swap(type, u.type); std::swap(value, u.value); return *this; } { std::swap(type, u.type); std::swap(value, u.value); return *this; }
~CharacterUnion() { Reset(); } ~CharacterUnion() { Reset(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment