Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ Add `#include "IntervalTree.h"` to the source files in which you will use the in
To make an IntervalTree to contain objects of class T, use:

```c++
vector<Interval<T> > intervals;
IntervalTree<int, T>::interval_vector intervals;
T a, b, c;
intervals.push_back(Interval<T>(2, 10, a));
intervals.push_back(Interval<T>(3, 4, b));
intervals.push_back(Interval<T>(20, 100, c));
IntervalTree<T> tree;
tree = IntervalTree<T>(intervals);
intervals.push_back(IntervalTree<int, T>::interval(2, 10, a));
intervals.push_back(IntervalTree<int, T>::interval(3, 4, b));
intervals.push_back(IntervalTree<int, T>::interval(20, 100, c));
IntervalTree<int, T> tree;
tree = IntervalTree<int, T>(move(intervals));
```

Now, it's possible to query the tree and obtain a set of intervals which are contained within the start and stop coordinates.

```c++
vector<Interval<T> > results;
tree.findContained(start, stop, results);
IntervalTree<int, T>::interval_vector results;
results = tree.findContained(start, stop);
cout << "found " << results.size() << " overlapping intervals" << endl;
```

Expand Down