std::move support for Matrix/Array
Submitted by Hauke Heibel
Assigned to Hauke Heibel
Link to original bugzilla bug (#266)
Version: 3.2
Description
Created attachment 170
Enables std::move support on Matrix, Array and a minimal set of required classes.
I have send this already to the list. With the attached patch, I enable r-value constructors in Array, Matrix and a few related classes such that PlainObjects are now std::move enabled.
This means, that in C++0x environment dynamic Matrix and Array objects could be returned from any function by value without triggering a copy in an assignment.
Here is an example:
MatrixXd square(const MatrixXd& m)
{
return m*m;
}
MatrixXd m2 = square( MatrixXd::Random(500,500) );
During this assignment we could be sure that no additional temporary is created without the need of ReturnByValue.
I think this feature would be really great since it would allow users to benefit from new language features without the need of tricky constructs such as ReturnByValue.
- Hauke
Patch 170, "Enables std::move support on Matrix, Array and a minimal set of required classes.":
move_support.patch