I am iterating a boost interval_set<unsigned_int>
, and I was expecting each iterator to be a boost interval
, whose values would be accessed with the upper
and lower
methods:
boost::icl::interval_set<unsigned int> outages;
// ...
// Insert intervals into the database
for(boost::icl::interval_set<unsigned int>::iterator it =
outages.begin(); it != outages.end(); it++){
DATA_ACQUISITION::InsertInterval(db, it->lower(),
it->upper())
}
But I am receiving errors at both lower
and upper
methods: Method ... could not be resolved, which suggests me that the iterator is not pointing to an interval
at all.
So, what am I really iterating here? How to iterate though the intervals
inserted into the interval
_set?
EDIT: Adding SSCCE:
#include <boost/icl/interval_set.hpp>
#include <iostream>
#include <vector>
int main() {
boost::icl::interval_set<unsigned int> outages;
for(unsigned int i=0; i<5; i++){
outages += boost::icl::discrete_interval<unsigned int>::closed(
(i*10), ((i*10) + 5));
}
for(boost::icl::interval_set<unsigned int>::iterator it =
outages.begin(); it != outages.end(); it++){
std::cout << it->lower() << boost::icl::upper(*it);
}
return 0;
}
Additional info:
Finally, I realised that the errors where not from compilation but from Eclipse CDT, and have no effect at all.