56 copy(a.
begin(), a.
end(), ostream_iterator<int>(*
os_,
" "));
61 copy(a.
begin(), a.
end(), back_inserter(b));
75 copy(a.
begin(), a.
end(), ostream_iterator<int>(*
os_,
" "));
80 copy(a.
begin(), a.
end(), back_inserter(b));
83 for (
int i=0; i<5; i++)
92 copy(a.
begin(), a.
end(), back_inserter(b));
98 copy(c.
begin(), c.
end(), back_inserter(d));
112 for (
int i=0; i<3; i++)
114 for (
int i=3; i<6; i++)
116 for (
int i=6; i<11; i++)
120 for (
int i=13; i<18; i++)
122 for (
int i=18; i<100; i++)
131 for (
int i=0; i<5; i++)
133 for (
int i=5; i<10; i++)
142 istringstream iss(
" \t [-2,5] ");
154 istringstream iss(
" \t 420 ");
159 istringstream iss2(
" \n 420- ");
164 istringstream iss3(
" \n 420-goober ");
169 istringstream iss4(
" \n 420-666");
178 istringstream iss(
"1,100");
179 iss.imbue(locale(
"C"));
192 a.
parse(
" [-3,2] [5,5] [8,9] booger ");
198 copy(a.
begin(), a.
end(), back_inserter(b));
216 a.
parse(
" [-3,2] 5 8-9 10- ");
223 for (
int i=0; i<11; ++i, ++it)
241 int main(
int argc,
char* argv[])
247 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
forward iterator providing readonly access to the virtual container
size_t intervalCount() const
returns the number of intervals in the set
bool empty() const
true iff IntegerSet is empty
const_iterator end() const
bool contains(int n) const
true iff n is in the IntegerSet
a virtual container of integers, accessible via an iterator interface, stored as union of intervals ...
void testIntervalExtraction2()
bool hasUpperBound(int n) const
true iff n is an upper bound for the IntegerSet
void testIntervalExtraction()
size_t size() const
returns the number of integers in the set
void parse(const std::string &intervalList)
insert intervals by parsing a string representing a whitespace-delimited list of closed intervals: pa...
int main(int argc, char *argv[])
const_iterator begin() const
#define TEST_PROLOG(argc, argv)
a single closed interval of integers
void insert(Interval interval)
insert an interval of integers into the virtual container