We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 504ea0c commit 6bc3428Copy full SHA for 6bc3428
src/KeyFrame.cpp
@@ -75,9 +75,10 @@ void Keyframe::AddPoint(Point p) {
75
// New point needs to be inserted before candidate; thus move
76
// candidate and all following one to the right and insert new
77
// point then where candidate was.
78
- Points.push_back(p); // Make space; could also be a dummy point.
79
- std::move_backward(candidate, end(Points) - 1, end(Points));
80
- *candidate = p;
+ size_t const candidate_index = candidate - begin(Points);
+ Points.push_back(p); // Make space; could also be a dummy point. INVALIDATES candidate!
+ std::move_backward(begin(Points) + candidate_index, end(Points) - 1, end(Points));
81
+ Points[candidate_index] = p;
82
}
83
84
0 commit comments