gz-math icon indicating copy to clipboard operation
gz-math copied to clipboard

Many objects are not std::move-able

Open osrf-migration opened this issue 7 years ago • 7 comments

Original report (archived issue) by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


In order to use std::move semantics in c++ (like assignment of unique_ptr's), objects need to have move constructor and move assignment operators defined (also known as the rule of 5. This lets you do things like this:

std::unique_ptr<math::Pose3d> ptr1, ptr2;
ptr1.reset(new math::Pose3d);
ptr2 = ptr1;

but that doesn't currently work because we aren't following the rule of 5 for many of our classes. I mention this because I was trying to use it in a gazebo plugin and it didn't work. I've added some statements to unit tests in b25df8976d840625395e66cd8a0966d69d1405f6 that illustrate this failure to compile.

osrf-migration avatar Aug 04 '17 22:08 osrf-migration

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


IssueForNewDevelopers

osrf-migration avatar Aug 04 '17 22:08 osrf-migration

Note that you could also use the "rule of 0". This means that if you don't create any special member functions, you will also get default move constructors.

For example for Quaternion this would means that you should delete the empty destructor.

Rayman avatar Oct 15 '20 08:10 Rayman

Hello @chapulina , I am new to this repository but i have experience with simulators. gazebo is an interesting project in my opinion i can contribute to. please do let me know if this issue is still unassigned, i can work into this for the beginning. thanks

Aetherbase avatar Sep 12 '21 01:09 Aetherbase

Hi @Aetherbase,

If you want to contribute to the Ignition project you can follow these steps:

You can assign me as a reviewer if you decide to open a new PR.

ahcorde avatar Sep 13 '21 08:09 ahcorde

thanks @ahcorde will do as suggested. i was just asking to confirm if anyone is already assigned to work on this issue.

Aetherbase avatar Sep 13 '21 11:09 Aetherbase

nope! You can work on it ;)

ahcorde avatar Sep 13 '21 11:09 ahcorde

If we're bumping gz-math, this would be a great opportunity to clean this up.

azeey avatar Oct 05 '23 20:10 azeey