From 000840cae0568da3c9148ddfe18b2af5b3e24067 Mon Sep 17 00:00:00 2001 From: Viktor Csomor Date: Wed, 7 Feb 2018 19:10:54 +0100 Subject: Added a move constructor and move assignment operator to Tensor and wrote some tests. --- unsupported/Eigen/CXX11/src/Tensor/Tensor.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'unsupported/Eigen/CXX11/src/Tensor/Tensor.h') 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::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) { -- cgit v1.2.3