初始化std :: Eigen :: Map数组

问题描述 投票:0回答:1

我正在为某些数据std::array<std::array<double,3>,4> a编写接口。我希望能够将数据解释为std::arrayEigen::Map<Eigen::Vector3d>。如果没有默认的初始值设定项,如何初始化std::array?基本上,数组必须在构造函数中的{}之前构建。

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_;
}

示例data_被包括来演示从单个std::array<double,3>构造一张地图。

c++ arrays c++11 eigen eigen3
1个回答
0
投票

最明显的方法是将in[index].data()重复4次,作为数组采用的所有元素:

© www.soinside.com 2019 - 2024. All rights reserved.