Range intersection is a simple, but non-trivial problem.
Its has been answered twice already:
Overlapping Ranges:
Prep O(n log n):
Make a second vector of ints. This represents the point at which you can stop searching.
int stop[size];
stop[size-1] = Ranges[size - 1].start;
for (int i = size - 2; i >= 0; i--)
{
stop[i] = min(Ranges[i].start, stop[i+1]);
}
Search:
Iterator starting at the binary search until stop[i] > TestRange.End:
2a. If the range if the current range is within the TestRange, add it to your result.