我无法理解在以下情况下如何释放 C++ std::vector 容器
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<cv::Point> cur_points;
for(int i = 0; i < num_curves; ++i)
{
cur_points = CreatePolyPoints(m_curves[i]);
curves[i] = &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<cv::Point> CreatePolyPoints(Curve curve)
{
std::vector<cv::Point> points;
//Do work here here
while(something)
{
cv::Point cur_point;
points.push_back(cur_point);
}
return points;
}
提前致谢。如果有人对我的目标感兴趣:在给定由“n”条曲线定义的多边形的情况下生成 ROI。