Making deletions and resizing keypoint array

After detecting a bunch of blobs I want to edit the keypoints list of their coordinates and apply custom criteria which I have a good idea how to do it. But problem is how do I “trim” the list, that is, delete sets of coordinates in the keypoints. I can write zeros to the keypoint list to indicate deletion, but my .size() would still be artificially high.

x  = binKeypoints[0].pt.x;
y = binKeypoints[0].pt.y;
x1 =  binKeypoints[1].pt.x;
y1 = binKeypoints[1].pt.y;
x2 =  binKeypoints[2].pt.x;
y2 = binKeypoints[2].pt.y;
int object_num = binKeypoints.size()

std::cout<<"Object Nums:" << object_num << std::endl;

std::vector has a erase method

you can also loop over your keypoints, and push_back to a new vector, if some criteria is hit