This forum has been archived. All content is frozen. Please use KDE Discuss instead.

move semantics

Tags: eigen eigen eigen
(comma "," separated)
kikiki
Registered Member
Posts
4
Karma
0

move semantics

Sat Apr 09, 2016 12:52 am
I know Copy Elision can deal with return type.

However, I have a type derived from VectorXd, let's say MyVector. Is it possible to move one to another? For examle,

Code: Select all
VectorXd foo1();
MyVector vec1 = foo1();

MyVector foo2();
VectorXd vec2 = foo2();


And sometimes it is reasonable to move a MatrixXd with 1 column to VectorXd (here MyVector). Even more general case is converting a return matrix into a column vector.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: move semantics

Mon Apr 11, 2016 3:56 pm
In Eigen 3.3 (beta-1 or devel branch), move semantic is supported for exact same types. Generalizing to compatible sizes and storage layout would be easy (patch welcome, see src/Core/Matrix.h line 272), but for reshaping, we would first need a proper API for that.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient