@@ -105,22 +105,6 @@ 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
-
124
108
/* * \returns a quaternion representing an identity rotation
125
109
* \sa MatrixBase::Identity()
126
110
*/
@@ -295,14 +279,24 @@ class Quaternion : public QuaternionBase<Quaternion<_Scalar,_Options> >
295
279
#if EIGEN_HAS_RVALUE_REFERENCES
296
280
// We define a copy constructor, which means we don't get an implicit move constructor or assignment operator.
297
281
/* * Default move constructor */
298
- EIGEN_DEVICE_FUNC inline Quaternion (Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value) = default;
282
+ EIGEN_DEVICE_FUNC inline Quaternion (Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value)
283
+ {
284
+ m_coeffs (std::move (other.coeffs ()));
285
+ }
299
286
300
287
/* * Default move assignment operator */
301
- EIGEN_DEVICE_FUNC Quaternion& operator =(Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) = default ;
288
+ EIGEN_DEVICE_FUNC Quaternion& operator =(Quaternion&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
289
+ {
290
+ m_coeffs = std::move (other.coeffs ());
291
+ return *this ;
292
+ }
302
293
303
294
// And now because we declared a constructor, we don't get an implicit copy constructor. Say we want one.
304
295
/* * Default copy constructor */
305
- EIGEN_DEVICE_FUNC Quaternion (const Quaternion& other) = default;
296
+ EIGEN_DEVICE_FUNC Quaternion (const Quaternion& other)
297
+ {
298
+ m_coeffs = other.coeffs ();
299
+ }
306
300
#endif
307
301
308
302
EIGEN_DEVICE_FUNC static Quaternion UnitRandom ();
@@ -657,7 +651,7 @@ EIGEN_DEVICE_FUNC Quaternion<Scalar,Options> Quaternion<Scalar,Options>::UnitRan
657
651
const Scalar u1 = internal::random<Scalar>(0 , 1 ),
658
652
u2 = internal::random<Scalar>(0 , 2 *EIGEN_PI),
659
653
u3 = internal::random<Scalar>(0 , 2 *EIGEN_PI);
660
- const Scalar a = sqrt (1 - u1),
654
+ const Scalar a = sqrt (Scalar ( 1 ) - u1),
661
655
b = sqrt (u1);
662
656
return Quaternion (a * sin (u2), a * cos (u2), b * sin (u3), b * cos (u3));
663
657
}
0 commit comments