Skip to content

An STL compatible implementation of the RangeSet datastructure

License

Notifications You must be signed in to change notification settings

hl037/rangeset.hpp

Repository files navigation

RangeSet

This header-only library provides a RangeSet class similar to the java google guava one.

it is used like this :

RangeSet<int>() set;
set.insert(20, 40);

set.insert(30, 50);

set.insert(80, 90);

set.remove(22, 28);

std::cout<<(set.find(25) != set.end())<<endl; // 0
std::cout<<(set.find(20) != set.end())<<endl; // 1

std::cout<<(set.find(25, 30) != set.end())<<endl; // 0
std::cout<<(set.find(30, 35) != set.end())<<endl; // 1

for(const std::pair<int, int> & r : set){
  std::cout<<"[ "<<r.first<<" , "<<r.second<<")"<<std::endl;
}
// [ 20 , 22 )
// [ 28 , 50 )
// [ 80 , 90 )

You can build and run the tests with :

make all
make run

...It will also generate coverage informations. To get a report, do make coverage

Any code on master the branch is extensively tested and require 100% coverage.

The library is still under developpement and features like merge, set difference are coming.

About

An STL compatible implementation of the RangeSet datastructure

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published