Quick c++ question, possibly an idiotic one...
If i have a function, say:
vector<Point2f> dothings(vector<Point2f> cornerPoints)
{
int 2 = 2;
int 3 = 3;
cornerPoints.push_back(2);
cornerPoints.push_back(3);
}
and i want to call it like this:
dothings(pointArray);
BUT, i to also specify the resulting array. So I pass it 'pointArray', but I want it to give back a NEW array, with the additions from the function.
So i want to say:
dothings(pointArray, newArray);
And newArray will be pointArray, plus the result of the dothings function.
How do i do this? a return? or a pointer?
thanks!
Open in new window
alternatively you would pass the input array as const std::vector<pointf> & and return a new array by value.
Open in new window
you would do the second if the arrays are small (say less than 100 points) and if the input array might be preserved by the caller.
Sara