# Revision history [back]

Are your trying to copy the pointer, or are you trying to copy the data itself? Because it looks like you're trying to copy the pointer. You should be able to simply declare the object elsewhere in your program and use the '=' operator without any real fuss.

Here's a complete example of copying the actual data:

#include <ros/ros.h>
#include <sensor_msgs/Range.h>

sensor_msgs::Range bar;

myCallbackFunction(const sensor_msgs::Range& foo) {
bar = foo;