Why does ros takes nodehandle as non const everywhere?

asked 2018-04-24 15:52:12 -0600

learningrobots gravatar image

Ros takes nodehanle as non const and non referenced which invokes the copy constructor every time we are passing the the node handle to a function. It may be not that expensive operation, but still it adds little bit given that it has a mutex lock and do lot of vector initialization.

Is there a reason why Ros always tries to invoke copy constructor for node handle and should my program should do the same thing and pass it non const and non referenced which invokes the copy constructor everytime?

edit retag flag offensive close merge delete

Comments

This may be my C++ being rusty, but if you're passing by reference, why would the copy-ctor be invoked?

Ros takes nodehanle as non const and non referenced

Could you please include some references for this? Where is 'ROS' (an ambiguous thing to state) doing this?

gvdhoorn gravatar image gvdhoorn  ( 2018-04-25 02:25:29 -0600 )edit