Remove trivial copy constructors and operators

This commit is contained in:
sfan5 2021-03-09 12:47:54 +01:00 committed by GitHub
parent cadbd62271
commit 4931b34625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1 additions and 152 deletions

@ -156,12 +156,6 @@ namespace scene
position.X = 0.f; position.X = 0.f;
} }
// construct copy constructor
SMD3QuaternionTag( const SMD3QuaternionTag & copyMe )
{
*this = copyMe;
}
// construct for searching // construct for searching
SMD3QuaternionTag( const core::stringc& name ) SMD3QuaternionTag( const core::stringc& name )
: Name ( name ) {} : Name ( name ) {}
@ -181,14 +175,6 @@ namespace scene
return Name == other.Name; return Name == other.Name;
} }
SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe )
{
Name = copyMe.Name;
position = copyMe.position;
rotation = copyMe.rotation;
return *this;
}
core::stringc Name; core::stringc Name;
core::vector3df position; core::vector3df position;
core::quaternion rotation; core::quaternion rotation;
@ -202,12 +188,6 @@ namespace scene
Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE); Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE);
} }
// construct copy constructor
SMD3QuaternionTagList(const SMD3QuaternionTagList& copyMe)
{
*this = copyMe;
}
virtual ~SMD3QuaternionTagList() {} virtual ~SMD3QuaternionTagList() {}
SMD3QuaternionTag* get(const core::stringc& name) SMD3QuaternionTag* get(const core::stringc& name)
@ -250,12 +230,6 @@ namespace scene
Container.push_back(other); Container.push_back(other);
} }
SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe)
{
Container = copyMe.Container;
return *this;
}
private: private:
core::array < SMD3QuaternionTag > Container; core::array < SMD3QuaternionTag > Container;
}; };

@ -639,13 +639,6 @@ namespace quake3
: ID ( 0 ), VarGroup ( 0 ) {} : ID ( 0 ), VarGroup ( 0 ) {}
virtual ~IShader () {} virtual ~IShader () {}
void operator = (const IShader &other )
{
ID = other.ID;
VarGroup = other.VarGroup;
name = other.name;
}
bool operator == (const IShader &other ) const bool operator == (const IShader &other ) const
{ {
return 0 == strcmp ( name.c_str(), other.name.c_str () ); return 0 == strcmp ( name.c_str(), other.name.c_str () );

@ -328,53 +328,6 @@ namespace video
*this = other; *this = other;
} }
//! Assignment operator
/** \param other Material to copy from. */
SMaterial& operator=(const SMaterial& other)
{
// Check for self-assignment!
if (this == &other)
return *this;
MaterialType = other.MaterialType;
AmbientColor = other.AmbientColor;
DiffuseColor = other.DiffuseColor;
EmissiveColor = other.EmissiveColor;
SpecularColor = other.SpecularColor;
Shininess = other.Shininess;
MaterialTypeParam = other.MaterialTypeParam;
MaterialTypeParam2 = other.MaterialTypeParam2;
Thickness = other.Thickness;
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
{
TextureLayer[i] = other.TextureLayer[i];
}
Wireframe = other.Wireframe;
PointCloud = other.PointCloud;
GouraudShading = other.GouraudShading;
Lighting = other.Lighting;
ZWriteEnable = other.ZWriteEnable;
BackfaceCulling = other.BackfaceCulling;
FrontfaceCulling = other.FrontfaceCulling;
FogEnable = other.FogEnable;
NormalizeNormals = other.NormalizeNormals;
ZBuffer = other.ZBuffer;
AntiAliasing = other.AntiAliasing;
ColorMask = other.ColorMask;
ColorMaterial = other.ColorMaterial;
BlendOperation = other.BlendOperation;
BlendFactor = other.BlendFactor;
PolygonOffsetFactor = other.PolygonOffsetFactor;
PolygonOffsetDirection = other.PolygonOffsetDirection;
PolygonOffsetDepthBias = other.PolygonOffsetDepthBias;
PolygonOffsetSlopeScale = other.PolygonOffsetSlopeScale;
UseMipMaps = other.UseMipMaps;
return *this;
}
//! Texture layer array. //! Texture layer array.
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES]; SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];

@ -140,9 +140,6 @@ class map
reset(); reset();
} }
// Copy constructor
Iterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
void reset(bool atLowest=true) void reset(bool atLowest=true)
{ {
if (atLowest) if (atLowest)
@ -161,13 +158,6 @@ class map
return Cur; return Cur;
} }
Iterator& operator=(const Iterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int) void operator++(int)
{ {
inc(); inc();
@ -287,8 +277,7 @@ class map
reset(); reset();
} }
// Copy constructor // Constructor(Iterator)
ConstIterator(const ConstIterator& src) : Root(src.Root), Cur(src.Cur) {}
ConstIterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {} ConstIterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
void reset(bool atLowest=true) void reset(bool atLowest=true)
@ -309,13 +298,6 @@ class map
return Cur; return Cur;
} }
ConstIterator& operator=(const ConstIterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int) void operator++(int)
{ {
inc(); inc();
@ -453,13 +435,6 @@ class map
return Cur; return Cur;
} }
ParentFirstIterator& operator=(const ParentFirstIterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int) void operator++(int)
{ {
inc(); inc();
@ -552,13 +527,6 @@ class map
return Cur; return Cur;
} }
ParentLastIterator& operator=(const ParentLastIterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int) void operator++(int)
{ {
inc(); inc();

@ -24,8 +24,6 @@ class line2d
line2d(T xa, T ya, T xb, T yb) : start(xa, ya), end(xb, yb) {} line2d(T xa, T ya, T xb, T yb) : start(xa, ya), end(xb, yb) {}
//! Constructor for line between the two points given as vectors. //! Constructor for line between the two points given as vectors.
line2d(const vector2d<T>& start, const vector2d<T>& end) : start(start), end(end) {} line2d(const vector2d<T>& start, const vector2d<T>& end) : start(start), end(end) {}
//! Copy constructor.
line2d(const line2d<T>& other) : start(other.start), end(other.end) {}
// operators // operators

@ -102,9 +102,6 @@ namespace core
//! Simple operator for linearly accessing every element of the matrix. //! Simple operator for linearly accessing every element of the matrix.
const T& operator[](u32 index) const { return M[index]; } const T& operator[](u32 index) const { return M[index]; }
//! Sets this matrix equal to the other matrix.
inline CMatrix4<T>& operator=(const CMatrix4<T> &other);
//! Sets all elements of this matrix to the value. //! Sets all elements of this matrix to the value.
inline CMatrix4<T>& operator=(const T& scalar); inline CMatrix4<T>& operator=(const T& scalar);
@ -1504,19 +1501,6 @@ namespace core
} }
template <class T>
inline CMatrix4<T>& CMatrix4<T>::operator=(const CMatrix4<T> &other)
{
if (this==&other)
return *this;
memcpy(M, other.M, 16*sizeof(T));
#if defined ( USE_MATRIX_TEST )
definitelyIdentityMatrix=other.definitelyIdentityMatrix;
#endif
return *this;
}
template <class T> template <class T>
inline CMatrix4<T>& CMatrix4<T>::operator=(const T& scalar) inline CMatrix4<T>& CMatrix4<T>::operator=(const T& scalar)
{ {

@ -55,9 +55,6 @@ class quaternion
//! inequality operator //! inequality operator
bool operator!=(const quaternion& other) const; bool operator!=(const quaternion& other) const;
//! Assignment operator
inline quaternion& operator=(const quaternion& other);
#ifndef IRR_TEST_BROKEN_QUATERNION_USE #ifndef IRR_TEST_BROKEN_QUATERNION_USE
//! Matrix assignment operator //! Matrix assignment operator
inline quaternion& operator=(const matrix4& other); inline quaternion& operator=(const matrix4& other);
@ -240,16 +237,6 @@ inline bool quaternion::operator!=(const quaternion& other) const
return !(*this == other); return !(*this == other);
} }
// assignment operator
inline quaternion& quaternion::operator=(const quaternion& other)
{
X = other.X;
Y = other.Y;
Z = other.Z;
W = other.W;
return *this;
}
#ifndef IRR_TEST_BROKEN_QUATERNION_USE #ifndef IRR_TEST_BROKEN_QUATERNION_USE
// matrix assignment operator // matrix assignment operator
inline quaternion& quaternion::operator=(const matrix4& m) inline quaternion& quaternion::operator=(const matrix4& m)

@ -27,8 +27,6 @@ public:
vector2d(T nx, T ny) : X(nx), Y(ny) {} vector2d(T nx, T ny) : X(nx), Y(ny) {}
//! Constructor with the same value for both members //! Constructor with the same value for both members
explicit vector2d(T n) : X(n), Y(n) {} explicit vector2d(T n) : X(n), Y(n) {}
//! Copy constructor
vector2d(const vector2d<T>& other) : X(other.X), Y(other.Y) {}
vector2d(const dimension2d<T>& other) : X(other.Width), Y(other.Height) {} vector2d(const dimension2d<T>& other) : X(other.Width), Y(other.Height) {}
@ -36,8 +34,6 @@ public:
vector2d<T> operator-() const { return vector2d<T>(-X, -Y); } vector2d<T> operator-() const { return vector2d<T>(-X, -Y); }
vector2d<T>& operator=(const vector2d<T>& other) { X = other.X; Y = other.Y; return *this; }
vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Height; return *this; } vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Height; return *this; }
vector2d<T> operator+(const vector2d<T>& other) const { return vector2d<T>(X + other.X, Y + other.Y); } vector2d<T> operator+(const vector2d<T>& other) const { return vector2d<T>(X + other.X, Y + other.Y); }

@ -28,15 +28,11 @@ namespace core
vector3d(T nx, T ny, T nz) : X(nx), Y(ny), Z(nz) {} vector3d(T nx, T ny, T nz) : X(nx), Y(ny), Z(nz) {}
//! Constructor with the same value for all elements //! Constructor with the same value for all elements
explicit vector3d(T n) : X(n), Y(n), Z(n) {} explicit vector3d(T n) : X(n), Y(n), Z(n) {}
//! Copy constructor
vector3d(const vector3d<T>& other) : X(other.X), Y(other.Y), Z(other.Z) {}
// operators // operators
vector3d<T> operator-() const { return vector3d<T>(-X, -Y, -Z); } vector3d<T> operator-() const { return vector3d<T>(-X, -Y, -Z); }
vector3d<T>& operator=(const vector3d<T>& other) { X = other.X; Y = other.Y; Z = other.Z; return *this; }
vector3d<T> operator+(const vector3d<T>& other) const { return vector3d<T>(X + other.X, Y + other.Y, Z + other.Z); } vector3d<T> operator+(const vector3d<T>& other) const { return vector3d<T>(X + other.X, Y + other.Y, Z + other.Z); }
vector3d<T>& operator+=(const vector3d<T>& other) { X+=other.X; Y+=other.Y; Z+=other.Z; return *this; } vector3d<T>& operator+=(const vector3d<T>& other) { X+=other.X; Y+=other.Y; Z+=other.Z; return *this; }
vector3d<T> operator+(const T val) const { return vector3d<T>(X + val, Y + val, Z + val); } vector3d<T> operator+(const T val) const { return vector3d<T>(X + val, Y + val, Z + val); }