Trying to get this copy/move thing right between matrices and vectors

This commit is contained in:
Eryn Wells 2014-08-10 09:42:02 -07:00
parent 96f782c4ac
commit 74bbc87610
2 changed files with 9 additions and 4 deletions

View file

@ -25,9 +25,10 @@ Vector4::Vector4(const Double& x,
}
Vector4::Vector4(const Matrix<4,1>&& rhs)
: Vector4(static_cast<const Vector4&&>(rhs))
{ }
Vector4::Vector4(const Matrix<4,1>& rhs)
{
memcpy(mData, rhs.CArray(), sizeof(Double) * 4);
}
/*
@ -86,6 +87,7 @@ Vector4::Z()
}
#if 0
/*
* charles::basics::Vector4::operator* --
*/
@ -95,6 +97,7 @@ Vector4::operator*(const Double& rhs)
{
return static_cast<Matrix<4,1>>(*this) * rhs;
}
#endif
/*

View file

@ -25,7 +25,7 @@ struct Vector4
: public Vector<4>
{
Vector4(const Double& x = 0.0, const Double& y = 0.0, const Double& z = 0.0);
Vector4(const Matrix<4,1>&& m);
Vector4(const Matrix<4,1>& m);
Double& X();
const Double& X() const;
@ -34,7 +34,9 @@ struct Vector4
Double& Z();
const Double& Z() const;
#if 0
Vector4 operator*(const Double& rhs) const;
#endif
Vector4 operator+(const Vector4& rhs) const;
Vector4& operator+=(const Vector4& rhs);