Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit f7b8747

Browse files
committed
Reinstate the user-defined copy-assignment operator
Because without it other ill-defined code may crash.
1 parent 159d94b commit f7b8747

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

System/Vector.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ namespace RTE {
6969
return returnVector;
7070
}
7171

72+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
73+
74+
Vector & Vector::operator=(const Vector &rhs) {
75+
if (*this != rhs) {
76+
m_X = rhs.m_X;
77+
m_Y = rhs.m_Y;
78+
}
79+
return *this;
80+
}
81+
7282
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7383

7484
Vector & Vector::operator=(const std::deque<Vector> &rhs) {

System/Vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ namespace RTE {
339339
/// </summary>
340340
/// <param name="rhs">A Vector reference.</param>
341341
/// <returns>A reference to the changed Vector.</returns>
342-
Vector & operator=(const Vector &rhs) = default;
342+
Vector & operator=(const Vector &rhs);
343343

344344
/// <summary>
345345
/// An assignment operator for setting this Vector equal to the average of an std::deque of Vectors.

0 commit comments

Comments
 (0)