ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Is the "=" operator overloaded for msg variables?

asked 2014-05-09 08:46:30 -0500

ggg gravatar image

Hi all,

I was worrying whether the "=" operator is systematically overloaded for objects of class sensor_msgs::JointState and other predefined messages in ROS. Up to now, I have programmed that "by hand" but it's a bit silly if the = operator is enough. That said, I do not know how to check that.

If it is the case for predefined messages, then is it also true when one defines their own message types (which I never had to do up to now, I must admit).

Thanks for any input.

        ggg
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-05-09 09:28:24 -0500

dornhege gravatar image

There is no need to overload the operator. Everything in messages is stored as values, so copy, assignment, etc. work as expected.

edit flag offensive delete link more
1

answered 2014-05-09 09:29:29 -0500

ahendrix gravatar image

Yes. ROS message types have an operator= in C++.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-05-09 08:46:30 -0500

Seen: 1,109 times

Last updated: May 09 '14