PrevUpHomeNext

Class year_monthday_iterator

fd::gregorian::year_monthday_iterator — Year level iterator, which stays at the day of month specified at construction time, with the ability to add an optional number of days to the resulting date.

Synopsis

// In header: <fd/date_iterators.h>


class year_monthday_iterator : public fd::gregorian::month_day_iterator {
public:

  // public member functions
  year_monthday_iterator(date_type, int, short);
};

Description

It's called 'year_monthday_iterator' to disambiguate it from boost date/time's year iterator. The latter has the problem that it is dependent on the date it is constructed from: If the date is the last day of the date's month then it automatically snaps to the last day, otherwise not. This is usually wrong for month-based iteration as the programmer needs to have control over the origin day of month.

year_monthday_iterator public member functions

  1. year_monthday_iterator(date_type d, int f, short originDayOfMonthSpec);

    Parameters:

    d

    Current date (year, month) where to set up the iterator.

    f

    Factor, i.e. how many years to forward on each iteration.

    originDayOfMonthSpec

    The day of month [1..31] to set up the iterator. Special values:

    • 0: Take origin day of month from specified date.

    • [-n..-1, 31..m]: Snap to last day of each month.


PrevUpHomeNext