title: c++ How to pass iterator pointer to function that expects the object by reference
body: <p>So in my body code I make an iterator to work through a list of pointers to Point objects and I need to be able to pass that pointer to the set_point_one function.</p>
  
  <pre><code>list&lt;Point*&gt;::iterator it = on.begin();
  l-&gt;set_point_one(*it);
  </code></pre>
  
  <p>The set_point_one function is overloaded like this:</p>
  
  <pre><code>void set_point_one(const double x, const double y, const double z) { one_.set_xyz(x, y, z); }
  void set_point_one(Point &amp;p) { one_.set_xyz(p.get_x(), p.get_y(), p.get_z()); } //trying to get it to use this one
  </code></pre>
  
  <p>When I run this code, I get the error:</p>
  
  <pre><code>./facet.cc:79:20: error: no matching member function for call to 'set_point_one'
              l-&gt;set_point_one(*it);                             //set both end points of the line to the point
              ~~~^~~~~~~~~~~~~
  ./line.cc:21:10: note: candidate function not viable: no known conversion from 'value_type' (aka 'Point *') to 'Point &amp;' for 1st argument; dereference the argument with
    *
  void set_point_one(Point &amp;p) { one_.set_xyz(p.get_x(), p.get_y(), p.get_z()); }
       ^
  ./line.cc:20:10: note: candidate function not viable: requires 3 arguments, but 1 was provided
  void set_point_one(const double x, const double y, const double z) { one_.set_xyz(x, y, z); }         ^
  </code></pre>
  
  <p>I've tried playing with dereferencing a bit with no luck. Is there something obvious I'm missing or is the only way for me to get it working to further overload the function so it also explicitly takes a pointer to the object?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Max</p>