aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/Tensor.h
diff options
context:
space:
mode:
authorGravatar Viktor Csomor <viktor.csomor@gmail.com>2018-02-07 19:10:54 +0100
committerGravatar Viktor Csomor <viktor.csomor@gmail.com>2018-02-07 19:10:54 +0100
commit000840cae0568da3c9148ddfe18b2af5b3e24067 (patch)
treeb2f7913976f50b6b2387f1a88f45e5a963b53112 /unsupported/Eigen/CXX11/src/Tensor/Tensor.h
parent3a2dc3869ed77cb6eca2beaad5c0af7d5134f15c (diff)
Added a move constructor and move assignment operator to Tensor and wrote some tests.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/Tensor.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/Tensor.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h
index 4fd96448f..e3f6e37f0 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h
@@ -398,6 +398,21 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp
internal::TensorExecutor<const Assign, DefaultDevice>::run(assign, DefaultDevice());
}
+ #if EIGEN_HAS_RVALUE_REFERENCES
+ EIGEN_DEVICE_FUNC
+ EIGEN_STRONG_INLINE Tensor(Self&& other)
+ : Tensor()
+ {
+ m_storage.swap(other.m_storage);
+ }
+ EIGEN_DEVICE_FUNC
+ EIGEN_STRONG_INLINE Tensor& operator=(Self&& other)
+ {
+ m_storage.swap(other.m_storage);
+ return *this;
+ }
+ #endif
+
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE Tensor& operator=(const Tensor& other)
{