我正在尝试将 Eigen 库与 armcc 编译器一起使用,将 Keil 用于 Cortex M3 目标,但出现编译错误:
Eigen/src/Core/Transpositions.h(387): error: #135: class template "Eigen::Transpose<Eigen::TranspositionsBase<Derived>>" has no member "derived"
它来自以下代码:
class Transpose<TranspositionsBase<TranspositionsDerived> >
{
typedef TranspositionsDerived TranspositionType;
typedef typename TranspositionType::IndicesType IndicesType;
public:
explicit Transpose(const TranspositionType& t) : m_transpositions(t) {}
Index size() const { return m_transpositions.size(); }
Index rows() const { return m_transpositions.size(); }
Index cols() const { return m_transpositions.size(); }
/** \returns the \a matrix with the inverse transpositions applied to the columns.
*/
template<typename OtherDerived> friend
const Product<OtherDerived, Transpose, AliasFreeProduct>
operator*(const MatrixBase<OtherDerived>& matrix, const Transpose& trt)
{
// !!!!!!! this line triggers the error
return Product<OtherDerived, Transpose, AliasFreeProduct>(matrix.derived(), trt.derived());
}
/** \returns the \a matrix with the inverse transpositions applied to the rows.
*/
template<typename OtherDerived>
const Product<Transpose, OtherDerived, AliasFreeProduct>
operator*(const MatrixBase<OtherDerived>& matrix) const
{
return Product<Transpose, OtherDerived, AliasFreeProduct>(*this, matrix.derived());
}
const TranspositionType& nestedExpression() const { return m_transpositions; }
protected:
const TranspositionType& m_transpositions;
};
我对模板魔法不是很好,所以我对它应该如何工作很感兴趣。
我在 Transpose 类中没有看到任何称为派生的方法,它没有从任何其他类继承。唯一具有该名称的方法在 TranspositionsBase 类中,它作为模板参数在 Transpose 中传递,据我所知,没有使用。
有人可以解释一下这里发生了什么吗?而且,如果可能的话,为什么会出现编译错误?