title: If A std::vector is Returned-By-Value when Is It Freed?
body: <p>I am having trouble understanding how the C++ std::vector container would get freed in the following scenario</p>
  
  <pre><code>void DoSomething()
  {
     cv::Point ** curves;
     int * curve_sizes;
     num_curves = m_curves.size(); //member variable holdings curves
     curves = new cv::Point*[num_curves];
     curve_size = new int[num_curves];
  
     std::vector&lt;cv::Point&gt; cur_points;
     for(int i = 0; i &lt; num_curves; ++i)
     {
       cur_points = CreatePolyPoints(m_curves[i]);
       curves[i] = &amp;cur_points[0];
       curve_sizes = cur_points.size();
     }
  
     cv::fillPoly(m_roi, curves, curve_sizes, num_curves, ... );
  
     //Clear the dynamic data
     // Do i do aything here?   
     delete [] curves;
     delete [] curve_sizes;
  }
  
  std::vector&lt;cv::Point&gt; CreatePolyPoints(Curve curve)
  {
     std::vector&lt;cv::Point&gt; points;
  
     //Do work here here
     while(something)
     {
       cv::Point cur_point;
       points.push_back(cur_point);
     }
  
     return points;
  }
  </code></pre>
  
  <p>Thanks in advance.  If anyone is interested in my goal: Generate an ROI given polygons defined by "n" curves.</p>