我尝试将 Eigen Map 放入类的定义中,但它无法通过编译器。以下是“ex.cc”文件。
#include <iostream>
#include <eigen3/Eigen/Dense>
using namespace Eigen; using namespace std;
class bc{
double a[10];
Map<ArrayXd> b(a, 10);
};
int main(){
bc x;
return 0;
}
编译器说:
ex.cc:6:19: error: ‘a’ is not a type
ex.cc:6:22: error: expected identifier before numeric constant
ex.cc:6:22: error: expected ‘,’ or ‘...’ before numeric constant
我不知道为什么。除了将 Map 放入一个类之外,我所做的与此处描述的完全一样。