Registered Member
|
What is wrong with the following derived class from Vector6d, the typedeffed name Eigen::Matrix<double,6,1>?
class Twist : public Vector6d { public: ... inline Eigen::VectorBlock<Vector6d, 3> v() { return head<3>(); } inline Eigen::VectorBlock<Vector6d, 3> w() { return tail<3>(); } inline const Eigen::VectorBlock<Vector6d, 3> v() const { return head<3>(); } // Error inline const Eigen::VectorBlock<Vector6d, 3> w() const { return tail<3>(); } // Error ... } The errors happen for the last two lines and unver MS VS2010 they are something like: error C2664: 'Eigen::VectorBlock<VectorType,Size>::VectorBlock(const Eigen::VectorBlock<VectorType,Size> &)' : Cannot change parameter 1 from 'const Eigen::VectorBlock<VectorType,Size>' to 'const Eigen::VectorBlock<VectorType,Size> &'. |
Registered Member
|
I found the solution. Just add 'const' in the template parameter as follows:
inline const Eigen::VectorBlock<const Vector6d, 3> v() const { return head<3>(); } inline const Eigen::VectorBlock<const Vector6d, 3> w() const { return tail<3>(); } |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot]