Using iterator over set of pointers to call it's pointer object methods
<p>I am a beginner as comes to working with iterators and want to iterate through names of my points printing them out. I do not know how to access them, help me out please with an idea. My approach looks like this:    </p>

<pre><code> set&lt;Point::Ptr&gt; points = world-&gt;getPoints(); // have set of pointers to Point

 Point::CPtr myPoint = *points.begin(); // dereferenced iterator to the first element
 Point::CPtr lastPoint = *points.rbegin(); //dereferenced iterator to the last valid element

 for(set&lt;Point::Ptr&gt;::iterator it = *points.begin(); it != points.end(); it++) {
    ROS_INFO("points are: %s: ", myPoint.get()-&gt;getName().c_str());
 }
</code></pre>

<p>Normally for iterator in a loop it shall be set to the first element of the set. But since set contains pointers and I want to be able to call functions available for objects inside those pointers, I tried this way.
It works for a one only element like that, giving me desired name:</p>

<pre><code>ROS_INFO("myPoint pointer gives %s: ", myPoint.get()-&gt;getName().c_str());
</code></pre>

<p>EDIT:
typedef boost::shared_ptr CPtr;</p>