Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Class template month_functor

boost::date_time::month_functor — Provides calculation to find next nth month given a date.

Synopsis

template<typename date_type> 
class month_functor {
public:
  // types
  typedef date_type::duration_type duration_type;
  typedef date_type::calendar_type cal_type;     
  typedef cal_type::ymd_type       ymd_type;     
  typedef cal_type::day_type       day_type;     

  // construct/copy/destruct
  month_functor(int);

  // public member functions
  duration_type get_offset(const date_type &) const;
  duration_type get_neg_offset(const date_type &) const;
};

Description

This adjustment function provides the logic for 'month-based' advancement on a ymd based calendar. The policy it uses to handle the non existant end of month days is to back up to the last day of the month. Also, if the starting date is the last day of a month, this functor will attempt to adjust to the end of the month.

month_functor public construct/copy/destruct

  1. month_functor(int f);

month_functor public member functions

  1. duration_type get_offset(const date_type & d) const;
  2. duration_type get_neg_offset(const date_type & d) const;

PrevUpHomeNext