C ++"向量矢量"

时间:2015-07-20 23:38:10

标签: c++ vector

我必须创建一个std::vector,其中包含Eigen::Vector2d的向量。这就是我做声明的方式:

std::vector< std::vector< Eigen::Vector2d > >  markingsPointSets;

我尝试推回我创建的一些元素:

Eigen::Vector2d firstMarkingPoint(markingPointA[0] + AB_perp[0] * .15, markingPointA[1] + AB_perp[1] * .15); // Don't mind to the value of this variable :p

markingsPointSets.at(i).push_back(firstMarkingPoint);

但是这给了我:

error c2719 formal parameter with __declspec(align('16')) won't be aligned

请告诉我是否有一些缺失信息可以找到此问题的根源。

1 个答案:

答案 0 :(得分:2)

您可能还没有看过documentation

  

在固定大小的可矢量化特征类型或具有此类类型成员的类上使用STL容器需要采取以下两个步骤:

     
      
  • 必须使用16字节对齐的分配器。 Eigen确实提供了一个可以使用的:aligned_allocator。

  •   
  • 如果您想使用std::vector容器,则需要#include&lt; Eigen / StdVector&gt;。

  •   
     

这些问题仅出现在固定大小的可矢量化特征类型和具有此类特征对象作为成员的结构中。对于其他特征类型,例如Vector3f或MatrixXd,使用STL容器时无需特别注意。

(强调我的)

相关问题