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