Visual Studio 2015.c++ 编译器错误 C2280 尝试引用已删除的函数

ole*_*g.v 3 c++ eigen visual-studio-2015 slam

我想做的是编译由 CMake 构建的项目。在我的代码中我有下一个方法:

/** "in-place" version of TriangularView::solve() where the result is written in \a other
  *
  * \warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here.
  * This function will const_cast it, so constness isn't honored here.
  *
  * See TriangularView:solve() for the details.
  */
template<typename MatrixType, unsigned int Mode>
template<int Side, typename OtherDerived>
void TriangularView<MatrixType,Mode>::solveInPlace(const MatrixBase<OtherDerived>& _other) const
{
    OtherDerived& other = _other.const_cast_derived();
    eigen_assert( cols() == rows() && ((Side==OnTheLeft && cols() == other.rows()) || (Side==OnTheRight && cols() == other.cols())) );
    eigen_assert((!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower)));

    enum { copy = internal::traits<OtherDerived>::Flags & RowMajorBit  && OtherDerived::IsVectorAtCompileTime };
    typedef typename internal::conditional<copy,
      typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
    OtherCopy otherCopy(other);

    internal::triangular_solver_selector<MatrixType, typename internal::remove_reference<OtherCopy>::type,
      Side, Mode>::run(nestedExpression(), otherCopy);

    if (copy)
      other = otherCopy;
}
Run Code Online (Sandbox Code Playgroud)

当我尝试编译时出现下一个错误:

error C2280 "Eigen::Block<Derived,-1,-1,false> &Eigen::Block<Derived,-1,-1,false>::operator =(const Eigen::Block<Derived,-1,-1,false> &)": attempting to reference a deleted function
Run Code Online (Sandbox Code Playgroud)

在线

other = otherCopy;
Run Code Online (Sandbox Code Playgroud)

我怎样才能摆脱它?

UPD

当我在 OtherDerived 上按 F12(“转到定义”)时,光标跳转到以下文件中的第 #332 行:http://codepad.org/9zN8inib

template<int Side, typename OtherDerived>
void solveInPlace(const MatrixBase<OtherDerived>& other) const;
Run Code Online (Sandbox Code Playgroud)

(最佳)

Ben*_*Ben 5

我自己也遇到过这个问题,结果发现这是Eigen 中的一个错误。就我而言,只需替换 src/Eigen/Eigen/src/Core/util/Macros.h 中的以下行

#if defined(_MSC_VER) && (!defined(__INTEL_COMPILER))
Run Code Online (Sandbox Code Playgroud)

#if defined(_MSC_VER) && (_MSC_VER < 1900) && (!defined(__INTEL_COMPILER))
Run Code Online (Sandbox Code Playgroud)

解决了这个问题。然后生成赋值运算符。