just now looking into this. not sure if i'm doign it wrong. a sanity check would be much appreciated.
edit: ok it seems like i am definitely missing the point. this is the usage case i'd like to accomodate: using arithmetic operators on matrix operations without any extraneous copies. if someone can assist in disabusing me of my ignorance that would be fantastic.Code:Matrix&& Matrix::operator +(const Matrix& b)const { Matrix result(*this); result+=b; return (Matrix&&)result; } Matrix::Matrix(Matrix&& rhs): data(rhs.data), rows(rhs.rows), cols(rhs.cols) { } void foo() { Matrix a; Matrix b; Matrix aPlusB(a+b); }
thanks.



LinkBack URL
About LinkBacks



