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

From Eigen::Matrix to std::vector using move semantics

Tags: None
(comma "," separated)
eftang
Registered Member
Posts
7
Karma
0
Hi,

I know these conversion topics have been raised multiple times but I could not find one referencing move semantics (to avoid copying data).

I am wondering if the following is safe:

Code: Select all
Eigen::MatrixXd A(n,n);

//fill matrix A

std::vector<double> A_vec;
A_vec.insert(A_vec.end(), std::make_move_iterator(A.data()), std::make_move_iterator(A.data() + A.size()));

//never use A again (except for destruction)



Jens


Bookmarks



Who is online

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