Fix implicit copy-constructor warning in TensorRef.

This commit is contained in:
C. Antonio Sanchez 2025-02-22 08:36:05 -08:00
parent 5fc6fc9881
commit e42dceb3a1

View File

@ -247,6 +247,8 @@ class TensorRef : public internal::TensorRefBase<TensorRef<PlainObjectType>> {
EIGEN_STRONG_INLINE TensorRef() : Base() {}
EIGEN_STRONG_INLINE TensorRef(const TensorRef& other) : Base(other) {}
template <typename Expression>
EIGEN_STRONG_INLINE TensorRef(const Expression& expr) : Base(expr) {
EIGEN_STATIC_ASSERT(internal::is_lvalue<Expression>::value,
@ -254,6 +256,8 @@ class TensorRef : public internal::TensorRefBase<TensorRef<PlainObjectType>> {
"TensorRef<const Expression>?)");
}
TensorRef& operator=(const TensorRef& other) { return Base::operator=(other).derived(); }
template <typename Expression>
EIGEN_STRONG_INLINE TensorRef& operator=(const Expression& expr) {
EIGEN_STATIC_ASSERT(internal::is_lvalue<Expression>::value,
@ -262,8 +266,6 @@ class TensorRef : public internal::TensorRefBase<TensorRef<PlainObjectType>> {
return Base::operator=(expr).derived();
}
TensorRef& operator=(const TensorRef& other) { return Base::operator=(other).derived(); }
template <typename... IndexTypes>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index firstIndex, IndexTypes... otherIndices) {
const std::size_t num_indices = (sizeof...(otherIndices) + 1);
@ -306,17 +308,17 @@ class TensorRef<const PlainObjectType> : public internal::TensorRefBase<TensorRe
public:
EIGEN_STRONG_INLINE TensorRef() : Base() {}
EIGEN_STRONG_INLINE TensorRef(const TensorRef& other) : Base(other) {}
template <typename Expression>
EIGEN_STRONG_INLINE TensorRef(const Expression& expr) : Base(expr) {}
TensorRef& operator=(const TensorRef& other) { return Base::operator=(other).derived(); }
template <typename Expression>
EIGEN_STRONG_INLINE TensorRef& operator=(const Expression& expr) {
return Base::operator=(expr).derived();
}
TensorRef(const TensorRef& other) : Base(other) {}
TensorRef& operator=(const TensorRef& other) { return Base::operator=(other).derived(); }
};
// evaluator for rvalues