@@ -100,6 +100,22 @@ class QuaternionBase : public RotationBase<Derived, 3>
100
100
EIGEN_DEVICE_FUNC Derived& operator =(const AngleAxisType& aa);
101
101
template <class OtherDerived > EIGEN_DEVICE_FUNC Derived& operator =(const MatrixBase<OtherDerived>& m);
102
102
103
+ #if EIGEN_HAS_RVALUE_REFERENCES
104
+ // Because we have a user-defined copy assignment operator, we don't get an implicit move constructor or assignment operator.
105
+ /* * Default move constructor */
106
+ EIGEN_DEVICE_FUNC inline QuaternionBase (QuaternionBase&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value) = default;
107
+
108
+ /* * Default move assignment operator */
109
+ EIGEN_DEVICE_FUNC QuaternionBase& operator =(QuaternionBase&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) = default ;
110
+
111
+ // And now because we declared a constructor, we don't get a default constructor or copy constructor. Say we want them.
112
+ /* * Default constructor */
113
+ EIGEN_DEVICE_FUNC QuaternionBase () = default;
114
+
115
+ /* * Copy constructor */
116
+ EIGEN_DEVICE_FUNC QuaternionBase (const QuaternionBase& other) = default;
117
+ #endif
118
+
103
119
/* * \returns a quaternion representing an identity rotation
104
120
* \sa MatrixBase::Identity()
105
121
*/
@@ -271,6 +287,19 @@ class Quaternion : public QuaternionBase<Quaternion<_Scalar,_Options> >
271
287
EIGEN_DEVICE_FUNC explicit inline Quaternion (const Quaternion<OtherScalar, OtherOptions>& other)
272
288
{ m_coeffs = other.coeffs ().template cast <Scalar>(); }
273
289
290
+ #if EIGEN_HAS_RVALUE_REFERENCES
291
+ // We define a copy constructor, which means we don't get an implicit move constructor or assignment operator.
292
+ /* * Default move constructor */
293
+ EIGEN_DEVICE_FUNC inline Quaternion (Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value) = default;
294
+
295
+ /* * Default move assignment operator */
296
+ EIGEN_DEVICE_FUNC Quaternion& operator =(Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) = default ;
297
+
298
+ // And now because we declared a constructor, we don't get an implicit copy constructor. Say we want one.
299
+ /* * Default copy constructor */
300
+ EIGEN_DEVICE_FUNC Quaternion (const Quaternion& other) = default;
301
+ #endif
302
+
274
303
EIGEN_DEVICE_FUNC static Quaternion UnitRandom ();
275
304
276
305
template <typename Derived1, typename Derived2>
0 commit comments