mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 16:49:38 +08:00
make fixed-size objects trivially move assignable
This commit is contained in:
parent
7fd305ecae
commit
bb73be8a2e
@ -123,10 +123,7 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
|
|||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array() = default;
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array() = default;
|
||||||
#endif
|
#endif
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(Array&&) = default;
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(Array&&) = default;
|
||||||
EIGEN_DEVICE_FUNC Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array& operator=(Array&&) = default;
|
||||||
Base::operator=(std::move(other));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \copydoc PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const
|
/** \copydoc PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const
|
||||||
* ArgTypes&... args)
|
* ArgTypes&... args)
|
||||||
|
@ -147,8 +147,10 @@ class ArrayBase : public DenseBase<Derived> {
|
|||||||
// inline void evalTo(Dest& dst) const { dst = matrix(); }
|
// inline void evalTo(Dest& dst) const { dst = matrix(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EIGEN_DEFAULT_COPY_CONSTRUCTOR(ArrayBase)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr ArrayBase() = default;
|
||||||
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(ArrayBase)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr ArrayBase(const ArrayBase&) = default;
|
||||||
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr ArrayBase(ArrayBase&&) = default;
|
||||||
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr ArrayBase& operator=(ArrayBase&&) = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit ArrayBase(Index);
|
explicit ArrayBase(Index);
|
||||||
|
@ -619,8 +619,9 @@ class DenseBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EIGEN_DEFAULT_COPY_CONSTRUCTOR(DenseBase)
|
|
||||||
/** Default constructor. Do nothing. */
|
/** Default constructor. Do nothing. */
|
||||||
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseBase(const DenseBase&) = default;
|
||||||
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseBase& operator=(DenseBase&&) = default;
|
||||||
#ifdef EIGEN_INTERNAL_DEBUGGING
|
#ifdef EIGEN_INTERNAL_DEBUGGING
|
||||||
EIGEN_DEVICE_FUNC constexpr DenseBase() {
|
EIGEN_DEVICE_FUNC constexpr DenseBase() {
|
||||||
/* Just checks for self-consistency of the flags.
|
/* Just checks for self-consistency of the flags.
|
||||||
|
@ -256,11 +256,7 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
|
|||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix() = default;
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix() = default;
|
||||||
#endif
|
#endif
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix(Matrix&&) = default;
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix(Matrix&&) = default;
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix& operator=(Matrix&& other)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix& operator=(Matrix&&) = default;
|
||||||
EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) {
|
|
||||||
Base::operator=(std::move(other));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \copydoc PlainObjectBase(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&... args)
|
/** \copydoc PlainObjectBase(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&... args)
|
||||||
*
|
*
|
||||||
|
@ -138,6 +138,8 @@ class MatrixBase : public DenseBase<Derived> {
|
|||||||
*/
|
*/
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const MatrixBase& other);
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const MatrixBase& other);
|
||||||
|
|
||||||
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr MatrixBase& operator=(MatrixBase&&) = default;
|
||||||
|
|
||||||
// We cannot inherit here via Base::operator= since it is causing
|
// We cannot inherit here via Base::operator= since it is causing
|
||||||
// trouble with MSVC.
|
// trouble with MSVC.
|
||||||
|
|
||||||
|
@ -474,10 +474,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
|||||||
protected:
|
protected:
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase() = default;
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase() = default;
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(PlainObjectBase&&) = default;
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(PlainObjectBase&&) = default;
|
||||||
EIGEN_DEVICE_FUNC constexpr PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase& operator=(PlainObjectBase&&) = default;
|
||||||
m_storage = std::move(other.m_storage);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Copy constructor */
|
/** Copy constructor */
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(const PlainObjectBase&) = default;
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(const PlainObjectBase&) = default;
|
||||||
|
@ -27,7 +27,9 @@ static_assert(std::is_trivially_copyable<DenseStorageD3x3>::value, "DenseStorage
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static_assert(std::is_trivially_move_constructible<Matrix4f>::value, "Matrix4f not trivially_move_constructible");
|
static_assert(std::is_trivially_move_constructible<Matrix4f>::value, "Matrix4f not trivially_move_constructible");
|
||||||
|
static_assert(std::is_trivially_move_assignable<Matrix4f>::value, "Matrix4f not trivially_move_assignable");
|
||||||
static_assert(std::is_trivially_move_constructible<Array4f>::value, "Array4f not trivially_move_constructible");
|
static_assert(std::is_trivially_move_constructible<Array4f>::value, "Array4f not trivially_move_constructible");
|
||||||
|
static_assert(std::is_trivially_move_assignable<Array4f>::value, "Array4f not trivially_move_assignable");
|
||||||
#if !defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN)
|
#if !defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN)
|
||||||
static_assert(std::is_trivially_copy_constructible<Matrix4f>::value, "Matrix4f not trivially_copy_constructible");
|
static_assert(std::is_trivially_copy_constructible<Matrix4f>::value, "Matrix4f not trivially_copy_constructible");
|
||||||
static_assert(std::is_trivially_copy_constructible<Array4f>::value, "Array4f not trivially_copy_constructible");
|
static_assert(std::is_trivially_copy_constructible<Array4f>::value, "Array4f not trivially_copy_constructible");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user