I get an error and when i click to see the error i takes me to a document called xutility.
This is the two errors:
- Error C2064 term does not evaluate to a function taking 2 arguments. Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\xutility 624
2.Error C2056 illegal expression Funtwo C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\xutility 624
Then when i looked at line 624 it shows me this
// FUNCTION TEMPLATE _Debug_lt_pred
template <class _Pr, class _Ty1, class _Ty2>
constexpr bool _Debug_lt_pred(_Pr&& _Pred, _Ty1&& _Left, _Ty2&& _Right) _NOEXCEPT_COND(
noexcept(_Pred(_Left, _Right))
&& noexcept(_Pred(_Right, _Left))) { // test if _Pred(_Left, _Right) and _Pred is strict weak ordering
const auto _Result = static_cast<bool>(_Pred(_Left, _Right));
if (_Result) {
_STL_VERIFY(!_Pred(_Right, _Left), "invalid comparator");
}
return _Result;
}
My class:
class Vector3D : public Vector2
{
public:
Vector3D();
~Vector3D();
double GetMagnitude();
void Normalize();
void scale(Vector3D vector);
void scale(double vector3x, double vector3y, double vector3z);
Vector3D operator -();
Vector3D operator +(Vector3D other);
Vector3D operator -(Vector3D other);
Vector3D operator *(Vector3D other);
Vector3D operator /(Vector3D other);
bool operator < (Vector3D other);
bool operator > (Vector3D other);
bool operator <= (Vector3D other);
bool operator >= (Vector3D other);
bool operator == (Vector3D other);
bool operator != (Vector3D other);
void operator = (Vector3D other);
void operator += (Vector3D other);
void operator -= (Vector3D other);
void operator *= (Vector3D other);
void operator /= (Vector3D other);
friend ostream& operator <<(ostream& out, const Vector3D& v);
friend istream& operator >>(istream& in, Vector3D& v);
double m_z = 0;
};
< operator Implementation
bool Vector3D::operator<(Vector3D other)
{
if (GetMagnitude() < other.GetMagnitude())
return true;
return false;
}
For the Implementation of each member:
Vector3D::Vector3D()
{
}
Vector3D::~Vector3D()
{
}
double Vector3D::GetMagnitude()
{
return sqrt(pow(m_x, 2) + pow(m_y, 2) + pow(m_z, 2));
}
void Vector3D::Normalize()
{
double maxValue = std::max(m_x, m_y, m_z);
m_x = m_x / maxValue;
m_y = m_y / maxValue;
m_z = m_z / maxValue;
}
void Vector3D::scale(Vector3D vector)
{
m_x *= vector.m_x;
m_y *= vector.m_y;
m_z *= vector.m_z;
}
void Vector3D::scale(double vector3x, double vector3y, double vector3z)
{
m_x *= vector3x;
m_y *= vector3y;
m_z *= vector3z;
}
Vector3D Vector3D::operator-()
{
Vector3D v;
v.m_x = -m_x;
v.m_y = -m_y;
v.m_z = -m_z;
return v;
}
Vector3D Vector3D::operator+(Vector3D other)
{
Vector3D v;
v.m_x = m_x + other.m_x;
v.m_y = m_y + other.m_y;
v.m_z = m_z + other.m_z;
return v;
}
Vector3D Vector3D::operator-(Vector3D other)
{
Vector3D v;
v.m_x = m_x - other.m_x;
v.m_y = m_y - other.m_y;
v.m_z = m_z - other.m_z;
return v;
}
Vector3D Vector3D::operator*(Vector3D other)
{
Vector3D v;
v.m_x = m_x * other.m_x;
v.m_y = m_y * other.m_y;
v.m_z = m_z * other.m_z;
return v;
}
Vector3D Vector3D::operator/(Vector3D other)
{
Vector3D v;
v.m_x = m_x / other.m_x;
v.m_y = m_y / other.m_y;
v.m_z = m_z / other.m_z;
return v;
}
bool Vector3D::operator<(Vector3D other)
{
if (GetMagnitude() < other.GetMagnitude())
return true;
return false;
}
bool Vector3D::operator>(Vector3D other)
{
if (GetMagnitude() > other.GetMagnitude())
return true;
return false;
}
bool Vector3D::operator<=(Vector3D other)
{
if (GetMagnitude() <= other.GetMagnitude())
return true;
return false;
}
bool Vector3D::operator>=(Vector3D other)
{
if (GetMagnitude() >= other.GetMagnitude())
return true;
return false;
}
bool Vector3D::operator==(Vector3D other)
{
if (GetMagnitude() == other.GetMagnitude())
return true;
return false;
}
bool Vector3D::operator!=(Vector3D other)
{
if (GetMagnitude() != other.GetMagnitude())
return true;
return false;
}
void Vector3D::operator=(Vector3D other)
{
m_x = other.m_x;
m_y = other.m_y;
m_z = other.m_z;
}
void Vector3D::operator+=(Vector3D other)
{
m_x += other.m_x;
m_y += other.m_y;
m_z += other.m_z;
}
void Vector3D::operator-=(Vector3D other)
{
m_x -= other.m_x;
m_y -= other.m_y;
m_z -= other.m_z;
}
void Vector3D::operator*=(Vector3D other)
{
m_x *= other.m_x;
m_y *= other.m_y;
m_z *= other.m_z;
}
void Vector3D::operator/=(Vector3D other)
{
m_x /= other.m_x;
m_y /= other.m_y;
m_z /= other.m_z;
}
ostream& operator<<(ostream& out, const Vector3D& v)
{
out << v.m_x << ", " << v.m_y << ", " << v.m_z;
return out;
}
istream& operator>>(istream& in, Vector3D& v)
{
cout << "Vector 2 Input" << endl << "x:";
in >> v.m_x;
cout << "y : ";
in >> v.m_y;
cout << "z : ";
in >> v.m_z;
return in;
}
I am just inheriting two members from class vector 2. They are x and y. m_x and m_y.