Go to the documentation of this file.
24 #ifndef _INTEGERSET_HPP_
25 #define _INTEGERSET_HPP_
50 bool contains(
int n)
const {
return n>=begin && n<=end;}
92 Intervals::const_iterator
it_;
93 Intervals::const_iterator
end_;
121 void parse(
const std::string& intervalList);
132 bool empty()
const {
return intervals_.empty();}
158 #endif // _INTEGERSET_HPP_
std::list< Interval > Intervals
collection of Interval objects
bool operator!=(const Iterator &that) const
void parse(const std::string &intervalList)
insert intervals by parsing a string representing a whitespace-delimited list of closed intervals: pa...
Iterator()
default constructed Iterator marks end of any IntegerSet
friend PWIZ_API_DECL std::ostream & operator<<(std::ostream &os, const IntegerSet &integerSet)
std::forward_iterator_tag iterator_category
size_t size() const
returns the number of integers in the set
const_iterator begin() const
bool operator==(const Iterator &that) const
IntegerSet()
default construction
bool contains(int n) const
bool contains(int n) const
true iff n is in the IntegerSet
void insert(Interval interval)
insert an interval of integers into the virtual container
const Iterator operator++(int)
bool empty() const
true iff IntegerSet is empty
Iterator(const IntegerSet &integerSet)
initialized to beginning of the IntegerSet
IntegerSet(int a)
construction with a single integer
Intervals::const_iterator end_
size_t intervalCount() const
returns the number of intervals in the set
const_iterator end() const
Intervals::const_iterator it_
void insert(int a, int b)
insert an interval of integers into the virtual container
a single closed interval of integers
forward iterator providing readonly access to the virtual container
friend PWIZ_API_DECL std::ostream & operator<<(std::ostream &os, const Interval &interval)
friend PWIZ_API_DECL std::istream & operator>>(std::istream &is, Interval &interval)
bool hasUpperBound(int n) const
true iff n is an upper bound for the IntegerSet
IntegerSet(int a, int b)
construction with a single interval
void insert(int a)
insert a single integer into the virtual container
a virtual container of integers, accessible via an iterator interface, stored as union of intervals