fd::gregorian::month_day_iterator — Day-of-month iterator, which stays at the date of month specified at construction time, with the ability to add an optional number of days to the resulting date.
// In header: <fd/date_iterators.h> class month_day_iterator : public fd::gregorian::date_iterator_interface { public: // public member functions month_day_iterator(date_type, int, short); constexpr duration_type get_offset(const date_type &) const; constexpr duration_type get_neg_offset(const date_type &) const; constexpr short origin_day_spec() const; // private member functions constexpr duration_type offset(const date_type &, int(boost::date_time::wrapping_int2< short, 1, 12 >::*)(int)) const; };
It's called 'month_day_iterator' to disambiguate it from boost date/time's month 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.
month_day_iterator
public member functionsmonth_day_iterator(date_type d, int f, short originDayOfMonthSpec);
Parameters: |
|
constexpr duration_type get_offset(const date_type & current) const;
constexpr duration_type get_neg_offset(const date_type & current) const;
constexpr short origin_day_spec() const;