【发布时间】:2014-09-29 07:51:28
【问题描述】:
我有以下课程:
class Foo
{
public:
Foo(double a, double b, double c, double d, double e)
// This does not work:
// : m_bar(a, b, c, d, e)
{
m_bar << a, b, c, d, e;
}
private:
// How can I make this const?
Eigen::Matrix<double, 5, 1, Eigen::DontAlign> m_bar;
};
如何使 m_bar const 并将其宽度 a 初始化为 f 作为构造函数中的值? C++11 也可以,但是 eigen 似乎不支持初始化列表...
【问题讨论】:
-
你的意思是那个库:eigen.tuxfamily.org?
-
是的,完全正确!版本 3.2.1
标签: c++ constructor constants eigen initializer-list