Ask Your Question
2

Is the "=" operator overloaded for msg variables?

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

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 -0600

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 -0600

ahendrix gravatar image

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 682 times

Last updated: May 09 '14