Browse Source

GCC 4.5 compatibility: cannot default some move operators.

I don't know why.
Vladimír Vondruš 13 years ago
parent
commit
115e73f967
  1. 6
      src/Trade/AbstractMaterialData.cpp
  2. 2
      src/Trade/AbstractMaterialData.h
  3. 7
      src/Trade/MeshObjectData2D.cpp
  4. 2
      src/Trade/MeshObjectData2D.h
  5. 7
      src/Trade/MeshObjectData3D.cpp
  6. 2
      src/Trade/MeshObjectData3D.h
  7. 9
      src/Trade/ObjectData2D.cpp
  8. 9
      src/Trade/ObjectData3D.cpp
  9. 7
      src/Trade/SceneData.cpp
  10. 13
      src/Trade/TextureData.h

6
src/Trade/AbstractMaterialData.cpp

@ -32,6 +32,12 @@ AbstractMaterialData::AbstractMaterialData(Type type): _type(type) {}
AbstractMaterialData::~AbstractMaterialData() {}
/* GCC 4.5 doesn't like it defaulted */
AbstractMaterialData& AbstractMaterialData::operator=(AbstractMaterialData&& other) {
std::swap(_type, other._type);
return *this;
}
Debug operator<<(Debug debug, const AbstractMaterialData::Type value) {
switch(value) {
#define _c(value) case AbstractMaterialData::Type::value: return debug << "Trade::AbstractMaterialData::Type::" #value;

2
src/Trade/AbstractMaterialData.h

@ -64,7 +64,7 @@ class MAGNUM_EXPORT AbstractMaterialData {
AbstractMaterialData& operator=(const AbstractMaterialData&) = delete;
/** @brief Move assignment */
AbstractMaterialData& operator=(AbstractMaterialData&&) = default;
AbstractMaterialData& operator=(AbstractMaterialData&&);
/** @brief Material type */
Type type() const { return _type; }

7
src/Trade/MeshObjectData2D.cpp

@ -28,4 +28,11 @@ namespace Magnum { namespace Trade {
MeshObjectData2D::MeshObjectData2D(std::vector<UnsignedInt> children, const Matrix3& transformation, UnsignedInt instance, UnsignedInt material): ObjectData2D(std::move(children), transformation, InstanceType::Mesh, instance), _material(material) {}
/* GCC 4.5 doesn't like it defaulted */
MeshObjectData2D& MeshObjectData2D::operator=(MeshObjectData2D&& other) {
ObjectData2D::operator=(std::move(other));
std::swap(_material, other._material);
return *this;
}
}}

2
src/Trade/MeshObjectData2D.h

@ -61,7 +61,7 @@ class MAGNUM_EXPORT MeshObjectData2D: public ObjectData2D {
MeshObjectData2D& operator=(const MeshObjectData2D&) = delete;
/** @brief Move assignment */
MeshObjectData2D& operator=(MeshObjectData2D&&) = default;
MeshObjectData2D& operator=(MeshObjectData2D&&);
/** @brief Material ID */
UnsignedInt material() const { return _material; }

7
src/Trade/MeshObjectData3D.cpp

@ -28,4 +28,11 @@ namespace Magnum { namespace Trade {
MeshObjectData3D::MeshObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, UnsignedInt instance, UnsignedInt material): ObjectData3D(std::move(children), transformation, InstanceType::Mesh, instance), _material(material) {}
/* GCC 4.5 doesn't like it defaulted */
MeshObjectData3D& MeshObjectData3D::operator=(MeshObjectData3D&& other) {
ObjectData3D::operator=(std::move(other));
std::swap(_material, other._material);
return *this;
}
}}

2
src/Trade/MeshObjectData3D.h

@ -61,7 +61,7 @@ class MAGNUM_EXPORT MeshObjectData3D: public ObjectData3D {
MeshObjectData3D& operator=(const MeshObjectData3D&) = delete;
/** @brief Move assignment */
MeshObjectData3D& operator=(MeshObjectData3D&&) = default;
MeshObjectData3D& operator=(MeshObjectData3D&&);
/** @brief Material ID */
UnsignedInt material() const { return _material; }

9
src/Trade/ObjectData2D.cpp

@ -34,7 +34,14 @@ ObjectData2D::ObjectData2D(ObjectData2D&&) = default;
ObjectData2D::~ObjectData2D() = default;
ObjectData2D& ObjectData2D::operator=(ObjectData2D&&) = default;
/* GCC 4.5 doesn't like it defaulted */
ObjectData2D& ObjectData2D::operator=(ObjectData2D&& other) {
std::swap(_children, other._children);
std::swap(_transformation, other._transformation);
std::swap(_instanceType, other._instanceType);
std::swap(_instance, other._instance);
return *this;
}
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug operator<<(Debug debug, ObjectData2D::InstanceType value) {

9
src/Trade/ObjectData3D.cpp

@ -34,7 +34,14 @@ ObjectData3D::ObjectData3D(ObjectData3D&&) = default;
ObjectData3D::~ObjectData3D() = default;
ObjectData3D& ObjectData3D::operator=(ObjectData3D&&) = default;
/* GCC 4.5 doesn't like it defaulted */
ObjectData3D& ObjectData3D::operator=(ObjectData3D&& other) {
std::swap(_children, other._children);
std::swap(_transformation, other._transformation);
std::swap(_instanceType, other._instanceType);
std::swap(_instance, other._instance);
return *this;
}
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug operator<<(Debug debug, ObjectData3D::InstanceType value) {

7
src/Trade/SceneData.cpp

@ -30,6 +30,11 @@ SceneData::SceneData(std::vector<UnsignedInt> children2D, std::vector<UnsignedIn
SceneData::SceneData(SceneData&&) = default;
SceneData& SceneData::operator=(SceneData&&) = default;
/* GCC 4.5 doesn't like it defaulted */
SceneData& SceneData::operator=(SceneData&& other) {
std::swap(_children2D, other._children2D);
std::swap(_children3D, other._children3D);
return *this;
}
}}

13
src/Trade/TextureData.h

@ -72,7 +72,7 @@ class TextureData {
TextureData& operator=(const TextureData&) = delete;
/** @brief Move assignment */
TextureData& operator=(TextureData&&) = default;
TextureData& operator=(TextureData&&);
/** @brief Texture type */
Type type() const { return _type; }
@ -108,6 +108,17 @@ class TextureData {
UnsignedInt _image;
};
/* GCC 4.5 doesn't like it defaulted */
inline TextureData& TextureData::operator=(TextureData&& other) {
std::swap(_type, other._type);
std::swap(_minificationFilter, other._minificationFilter);
std::swap(_magnificationFilter, other._magnificationFilter);
std::swap(_mipmapFilter, other._mipmapFilter);
std::swap(_wrapping, other._wrapping);
std::swap(_image, other._image);
return *this;
}
/** @debugoperator{Magnum::Trade::TextureData} */
Debug MAGNUM_EXPORT operator<<(Debug debug, TextureData::Type value);

Loading…
Cancel
Save