Skip to content

Commit

Permalink
[core] Remove -Wconversion warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisv committed Jan 25, 2024
1 parent e122d6e commit da9ab67
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions include/pinocchio/spatial/motion-tpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,22 @@ namespace pinocchio
: m_data(clone.toVector())
{}

template<typename M2>
// Same explanation as converting constructor from MotionBase
template <typename M2,
typename std::enable_if<
!std::is_convertible<MotionDense<M2>, MotionTpl>::value,
bool>::type = true>
explicit MotionTpl(const MotionDense<M2> & clone)
{ linear() = clone.linear(); angular() = clone.angular(); }

template<typename M2>
// MotionBase implement a conversion function to PlainReturnType.
// Usually, PlainReturnType is defined as MotionTpl.
// In this case, this converting constructor is redundant and
// create a warning with -Wconversion
template <typename M2,
typename std::enable_if<
!std::is_convertible<MotionBase<M2>, MotionTpl>::value,
bool>::type = true>
explicit MotionTpl(const MotionBase<M2> & clone)
{ *this = clone; }

Expand Down

0 comments on commit da9ab67

Please sign in to comment.