mercredi 22 janvier 2020

Initialize std::array of Eigen::Map

I am writing an interface to some data std::array<std::array<double,3>,4> a. I want to be able to interpret the data as a std::array of Eigen::Map<Eigen::Vector3d>. How can I initialize the std::array given I do not have a default initializer? Basically the array must be built before {} in the constructor.

class Interface{
  Interface( std::array<std::array<double,3>,4>& a ) :
  data_( a[0].data() ), // this works for initializing just the one
  array_of_data_( /* what goes here? */ ) {}
protected:
  Eigen::Map<Eigen::Vector3d> data_;
  std::array<Eigen::Map<Eigen::Vector3d>,4> array_of_data_;
}

the example data_ is included to demonstrate the construction of one map from a single std::array<double,3>.

Aucun commentaire:

Enregistrer un commentaire