The type of Point is irrelevant.
For the first issue, I think the best thing to do is use the
<
operator instead of
!=
operator in your condition for statement. This is because if you can't guarantee that the reference vector has a multiple of 10 values, then it's unlikely that you'll always get to a point where
RightMovmentIter==Rightarm.rend();
For the second issue;
bradw is partially right. You need to use push_back, but that isn't the only problem. In that statement, you are saying the summary is equal to the Rresult - Rresult which is zero. Then you are incrementing Rresult.
I'm not sure exactly what you are trying to do, but I suggest one of the following two approaches:
summary.push_back(*RresultIter - *(RresultIter+1) );
or
summary.push_back(*RresultIter - *(++RresultIter) );
The first will simply access the next element, the second will increment the iterator as well. Since you increment at the end of the for loop, you are incrementing twice per loop. That means if I have a vector of values like this:
the output vector from the first method would be
. The output vector from the second method would be
(The 3 is skipped). It's up to you which you want.
Regardless of what method you choose, you also have to change your for loop to ensure that you don't go beyond the bounds of the vector when you do this:
for(RresultIter = RightTracking.begin(); RresultIter != RightTracking.end()-1; RresultIter++)
Since you know that you are going to access one further element, you don't want to go all of the way to the end of the vector and subtract a non existent element from the last one.