What is the meaning of msgCallback(const ...::ConstPtr& ) ??
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.
Have a look at this question and answer