Here is my first stab at this:
icl::interval_set<Time> _badMonths; // Time is an internal class which defines all comparison operators
std::vector<int> badMonths; // populated with YYMM integers (eg: 1206 for June 2012)
for (int m : badMonths)
{
Time openInterval = Time(2000 + m / 100, m % 100, 1); // 1st day of the month
Time closeInterval = Time(2000 + m / 100, m % 100 + 1, 1) - TimeSpan::Days(1); // last day of the month
icl::interval<Time>::type month(openInterval, closeInterval);
_badMonths.insert(month);
}
// it is now my hope that _badMonths will contain a set of intervals where each interval is a month
How do I now check whether a single Time instance
intersects one of the intervals in the set?
Time timepoint;
if (_badMonths &=
timepoint)
std::cout <<
timepoint << " intersects bad months" << std::endl;
TIA
Steve