#ifndef INTERVALSET_H_ #define INTERVALSET_H_ #include #include class IntervalSet { typedef int key_t; // TODO?! template typedef std::pair value_t; typedef std::vector data_t; public: static const key_t npos; void clear(); // [start;end) ! void add(key_t start,key_t end=npos); void finish(); size_t size() const { return data.size(); } // only after finish() has been called: bool contains(key_t val) const; key_t next(key_t val) const; void dump() const; private: // currently not used bool intersect(const value_t &a,const value_t &b) const; void unite(value_t &aret,const value_t &b) const; private: data_t data; }; #endif