Date Generators / Algorithms
Introduction -- Header -- Class Overview
Date iterators provide a standard mechanism for iteration through dates. Date iterators are a model of Input Iterator and can be used to populate collections with dates and other date generation tasks. For example, the print month example iterates through all the days in a month and prints them.
All of the iterators here derive from boost::gregorian::date_iterator.
#include "boost/date_time/gregorian/gregorian.hpp" //include all types plus i/o or #include "boost/date_time/gregorian/gregorian_types.hpp" //no i/o just types
Class | Construction Parameters | Description |
date_iterator | Common base class for all day level iterators. | |
day_iterator | date start_date, int day_count=1 | Iterate day_count days at a time. |
week_iterator | date start_date, int week_offset=1 | Iterate week_offset weeks at a time. |
month_iterator | date start_date, int month_offset=1 | Iterate month_offset months. There are special rules for handling the end of the month. These are: if start date is last day of the month, always adjust to last day of the month. if date is beyond the end of the month (eg: jan 31 + 1 month) adjust back to end of month. |
year_iterator | date start_date, int year_offset=1 | Iterate year_offset years |