What is the meaning of msgCallback(const ...::ConstPtr& ) ??

asked 2018-11-10 10:21:59 -0500

goodgodgd gravatar image

Hello. I am studying "topic" example sources and I cannot understand the prototype of the callback function

void msgCallback(const package_name::message_name::ConstPtr& msg) { ... }

To my best understanding, some_type::ConstPtr works like const some_type*.
Then what is the reason that the additional const is appended?
Moreover, reference type (&) does not seems necessary for pointer type.
Does the reference type have anything useful?
Thanks in advance.

edit retag flag offensive close merge delete

Comments

2
ahendrix gravatar image ahendrix  ( 2018-11-10 13:11:41 -0500 )edit