diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index c3fd8c3e0..6fad6564a 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h @@ -105,6 +105,22 @@ class QuaternionBase : public RotationBase EIGEN_DEVICE_FUNC Derived& operator=(const AngleAxisType& aa); template EIGEN_DEVICE_FUNC Derived& operator=(const MatrixBase& m); +#if EIGEN_HAS_RVALUE_REFERENCES + // Because we have a user-defined copy assignment operator, we don't get an implicit move constructor or assignment operator. + /** Default move constructor */ + EIGEN_DEVICE_FUNC inline QuaternionBase(QuaternionBase&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) = default; + + /** Default move assignment operator */ + EIGEN_DEVICE_FUNC QuaternionBase& operator=(QuaternionBase&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) = default; + + // And now because we declared a constructor, we don't get a default constructor or copy constructor. Say we want them. + /** Default constructor */ + EIGEN_DEVICE_FUNC QuaternionBase() = default; + + /** Copy constructor */ + EIGEN_DEVICE_FUNC QuaternionBase(const QuaternionBase& other) = default; +#endif + /** \returns a quaternion representing an identity rotation * \sa MatrixBase::Identity() */ @@ -276,6 +292,19 @@ public: EIGEN_DEVICE_FUNC explicit inline Quaternion(const Quaternion& other) { m_coeffs = other.coeffs().template cast(); } +#if EIGEN_HAS_RVALUE_REFERENCES + // We define a copy constructor, which means we don't get an implicit move constructor or assignment operator. + /** Default move constructor */ + EIGEN_DEVICE_FUNC inline Quaternion(Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) = default; + + /** Default move assignment operator */ + EIGEN_DEVICE_FUNC Quaternion& operator=(Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) = default; + + // And now because we declared a constructor, we don't get an implicit copy constructor. Say we want one. + /** Default copy constructor */ + EIGEN_DEVICE_FUNC Quaternion(const Quaternion& other) = default; +#endif + EIGEN_DEVICE_FUNC static Quaternion UnitRandom(); template