update vector array

I have a vector of some numbers.
Each number have its start and end point .

say i have 5 points in a vector

0 = [0, 3]
1 = [7, 22]
2 = [40, 53]
3 = [55, 58]
4 = [70, 80]
5 = [90, 100]

now on each two pair of points. I have to compute distance and then combine both points if distance is less than 13.
for example, the distance between end points of 0 index and start points of index 1.. i meant end points is 3 for 0 index . and start point is 7 for 1 index. now if distance between 7 -3 = 4 <= 13.then i have to combine points 0[0,3] and 1[7,22].. so after combination my 0 index will have [0,22] and then index 1 should be delete from my vector. then move on next two points, index 3, and index 4. and do the same thing.
My problem is combining and deleting index from vector. i meant update the vector array. Can any one please help me how to do it?

Thanks
Topic archived. No new replies allowed.