Re: [eigen] What's the best way to copy an Eigen::Vector into a std::vector?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


So the answer is:
#include <algorithm>
#include <vector>
#include "Eigen/Core"

int main() {
    Eigen::VectorXd evec(10);
    std::vector<double> stdvec(10);
    // One solution
    std::copy(&evec[0], &evec[0] + evec.size(), stdvec.begin());
    // Another solution
    Eigen::VectorXd::Map(&stdvec[0], stdvec.size()) = evec;
}

How painful would it to be to support .begin() and .end() to return &evec[0] and &evec[0] + evec.size()? It is the STL way...

				R




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/