[ARITHMETIC OPERATORS][IMPLEMENTATION] implmeented the binary and compound / operator
This commit is contained in:
parent
12b867e1c9
commit
ee3197a0a6
3 changed files with 20 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ namespace rotgen
|
||||||
matrix_impl64& operator-();
|
matrix_impl64& operator-();
|
||||||
matrix_impl64& operator*=(matrix_impl64 const& rhs);
|
matrix_impl64& operator*=(matrix_impl64 const& rhs);
|
||||||
matrix_impl64& operator*=(double d);
|
matrix_impl64& operator*=(double d);
|
||||||
|
matrix_impl64& operator/=(double d);
|
||||||
|
|
||||||
friend std::ostream& operator<<(std::ostream&,matrix_impl64 const&);
|
friend std::ostream& operator<<(std::ostream&,matrix_impl64 const&);
|
||||||
friend bool operator==(matrix_impl64 const& lhs, matrix_impl64 const& rhs);
|
friend bool operator==(matrix_impl64 const& lhs, matrix_impl64 const& rhs);
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,12 @@ namespace rotgen
|
||||||
static_cast<parent&>(*this) *= rhs;
|
static_cast<parent&>(*this) *= rhs;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
matrix& operator/=(double rhs)
|
||||||
|
{
|
||||||
|
static_cast<parent&>(*this) /= rhs;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename S, int R, int C, int O, int MR, int MC>
|
template<typename S, int R, int C, int O, int MR, int MC>
|
||||||
|
|
@ -126,4 +132,11 @@ namespace rotgen
|
||||||
{
|
{
|
||||||
return rhs * lhs;
|
return rhs * lhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename S, int R, int C, int O, int MR, int MC>
|
||||||
|
matrix<S,R,C,O,MR,MC> operator/(matrix<S,R,C,O,MR,MC> const& lhs, double rhs)
|
||||||
|
{
|
||||||
|
matrix<S,R,C,O,MR,MC> that(lhs);
|
||||||
|
return that /= rhs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -119,4 +119,10 @@ namespace rotgen
|
||||||
storage_->data *= s;
|
storage_->data *= s;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
matrix_impl64& matrix_impl64::operator/=(double s)
|
||||||
|
{
|
||||||
|
storage_->data /= s;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue