add ReturnByValue pseudo expression for in-place evaluation with a

return-by-value API style (will soon use it for the transform products)
This commit is contained in:
Gael Guennebaud
2009-03-04 13:00:00 +00:00
parent 45136ac3b6
commit 6a26506341
5 changed files with 77 additions and 1 deletions

View File

@@ -289,9 +289,13 @@ class Matrix
*/
EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other)
{
return _set(other);
return _set(other);
}
template<typename OtherDerived,typename OtherEvalType>
EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue<OtherDerived,OtherEvalType>& func)
{ return Base::operator=(func); }
EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, +=)
EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, -=)
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, *=)
@@ -412,6 +416,10 @@ class Matrix
_check_template_params();
_set_noalias(other);
}
/** Copy constructor with in-place evaluation */
template<typename OtherDerived,typename OtherEvalType>
EIGEN_STRONG_INLINE Matrix(const ReturnByValue<OtherDerived,OtherEvalType>& other)
{ other.evalTo(*this); }
/** Destructor */
inline ~Matrix() {}