C++ Visual studio 2015。c++;试图引用已删除函数时出现编译器错误C2280

C++ Visual studio 2015。c++;试图引用已删除函数时出现编译器错误C2280,c++,visual-studio-2015,eigen,slam,C++,Visual Studio 2015,Eigen,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 f

我想做的是编译由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;
}
我怎样才能摆脱它

UPD

当我在OtherDerivated上点击F12(“转到定义”)时,光标跳到以下文件中的#332行:

模板
无效解算就地(常数矩阵和其他)常数;

(上一个)

您似乎试图通过执行以下操作来重新初始化引用

OtherDerived& other = _other.const_cast_derived();
然后

other = otherCopy;

我自己也遇到了这个,结果是一个在艾根。在我的例子中,只需替换src/Eigen/Eigen/src/Core/util/Macros.h中的以下行

#if defined(_MSC_VER) && (!defined(__INTEL_COMPILER))

#如果已定义(_MSC_VER)&&(_MSC_VER<1900)&(!已定义(_英特尔编译器))

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

您确定OtherDevertive具有副本构造函数吗?第5条规则
OtherDerived
类型是否具有复制构造函数?另外,根据我的经验,如果编译器由于任何原因(例如,其中一个成员没有默认的ctor)未能生成默认ctor或默认副本ctor,VS可能会生成这种类型的错误。我已经更新了帖子,请检查它。@Sleepwalker确保您没有遇到@MarcoA。你能看一下我发布的代码吗(我的问题又更新了一次)?它编译时没有任何更改,我仍然得到相同的错误。我不明白为什么你不能查看我的代码,也许你可以建议我更好的服务来共享代码?非常感谢。您的代码应该都在StackOverflow,这是一个好问题。我的意思是,当远程站点删除您的代码时,未来的读者将如何受益?请减少您的代码,使之成为一个最小的示例。@tomdertech好听!如果你有时间,请接受我的帖子作为回答。我不是OP
OtherDerived& other = _other.const_cast_derived();
other = otherCopy;
#if defined(_MSC_VER) && (!defined(__INTEL_COMPILER))
#if defined(_MSC_VER) && (_MSC_VER < 1900) && (!defined(__INTEL_COMPILER))