CGAL 5.6 - Interval Skip List
Loading...
Searching...
No Matches
Interval_skip_list/intervals.cpp
#include <CGAL/Interval_skip_list.h>
#include <CGAL/Interval_skip_list_interval.h>
#include <CGAL/algorithm.h>
#include <vector>
#include <list>
#include <iostream>
typedef CGAL::Interval_skip_list<Interval> Interval_skip_list;
int main()
{
Interval_skip_list isl;
int i, n, d;
n = 10;
d = 3;
//std::cin >> n >> d;
std::vector<Interval> intervals(n);
for(i = 0; i < n; i++) {
intervals[i] = Interval(i, i+d);
}
CGAL::cpp98::random_shuffle(intervals.begin(), intervals.end());
isl.insert(intervals.begin(), intervals.end());
for(i = 0; i < n+d; i++) {
std::list<Interval> L;
isl.find_intervals(i, std::back_inserter(L));
for(std::list<Interval>::iterator it = L.begin(); it != L.end(); it++){
std::cout << *it;
}
std::cout << std::endl;
}
for(i = 0; i < n; i++) {
isl.remove(intervals[i]);
}
return 0;
}
The class Interval_skip_list_interval represents intervals with lower and upper bound of type Value.
Definition: Interval_skip_list_interval.h:18
The class Interval_skip_list is a dynamic data structure that allows to find all members of a set of ...
Definition: Interval_skip_list.h:22
The concept Interval describes the requirements for the template argument Interval of a Interval_skip...
Definition: Interval.h:19
void random_shuffle(RandomAccessIterator begin, RandomAccessIterator end, RandomGenerator &random)