mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Added a move constructor and move assignment operator to Tensor and wrote some tests.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user