mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 11:19:02 +08:00
make fixed size matrices and arrays trivially_copy_constructible and trivially_move_constructible
This commit is contained in:
parent
132f281f50
commit
2d4c9b400c
@ -126,9 +126,7 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
|
|||||||
: Base(internal::constructor_without_unaligned_array_assert()){EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED}
|
: Base(internal::constructor_without_unaligned_array_assert()){EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC Array(Array && other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(Array && other) = default;
|
||||||
: Base(std::move(other)) {
|
|
||||||
}
|
|
||||||
EIGEN_DEVICE_FUNC Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) {
|
EIGEN_DEVICE_FUNC Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) {
|
||||||
Base::operator=(std::move(other));
|
Base::operator=(std::move(other));
|
||||||
return *this;
|
return *this;
|
||||||
@ -232,7 +230,7 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Copy constructor */
|
/** Copy constructor */
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(const Array& other) : Base(other) {}
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(const Array& other) = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateType {};
|
struct PrivateType {};
|
||||||
|
@ -258,9 +258,7 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
|
|||||||
internal::constructor_without_unaligned_array_assert)
|
internal::constructor_without_unaligned_array_assert)
|
||||||
: Base(internal::constructor_without_unaligned_array_assert()){EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED}
|
: Base(internal::constructor_without_unaligned_array_assert()){EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED}
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix(Matrix && other)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix(Matrix && other) = default;
|
||||||
EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value)
|
|
||||||
: Base(std::move(other)) {}
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix& operator=(Matrix&& other)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix& operator=(Matrix&& other)
|
||||||
EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) {
|
EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) {
|
||||||
Base::operator=(std::move(other));
|
Base::operator=(std::move(other));
|
||||||
@ -379,7 +377,7 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Copy constructor */
|
/** \brief Copy constructor */
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const Matrix& other) : Base(other) {}
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix(const Matrix& other) = default;
|
||||||
|
|
||||||
/** \brief Copy constructor for generic expressions.
|
/** \brief Copy constructor for generic expressions.
|
||||||
* \sa MatrixBase::operator=(const EigenBase<OtherDerived>&)
|
* \sa MatrixBase::operator=(const EigenBase<OtherDerived>&)
|
||||||
|
@ -485,8 +485,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC constexpr PlainObjectBase(PlainObjectBase&& other) EIGEN_NOEXCEPT
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(PlainObjectBase&& other) = default;
|
||||||
: m_storage(std::move(other.m_storage)) {}
|
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC constexpr PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT {
|
EIGEN_DEVICE_FUNC constexpr PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT {
|
||||||
m_storage = std::move(other.m_storage);
|
m_storage = std::move(other.m_storage);
|
||||||
@ -494,8 +493,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Copy constructor */
|
/** Copy constructor */
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(const PlainObjectBase& other)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(const PlainObjectBase& other) = default;
|
||||||
: Base(), m_storage(other.m_storage) {}
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
|
||||||
: m_storage(size, rows, cols) {
|
: m_storage(size, rows, cols) {
|
||||||
// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user