次のシナリオで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を生成します。