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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template months_duration

boost::date_time::months_duration — additional duration type that represents a logical month

Synopsis

// In header: <boost/date_time/date_duration_types.hpp>

template<typename base_config> 
class months_duration {
public:
  // construct/copy/destruct
  months_duration(int_rep);
  months_duration(special_values);

  // public member functions
  int_rep number_of_months() const;
  BOOST_CXX14_CONSTEXPR duration_type get_neg_offset(const date_type &) const;
  BOOST_CXX14_CONSTEXPR duration_type get_offset(const date_type &) const;
  BOOST_CONSTEXPR bool operator==(const months_type &) const;
  BOOST_CONSTEXPR bool operator!=(const months_type &) const;
  BOOST_CXX14_CONSTEXPR months_type operator+(const months_type &) const;
  BOOST_CXX14_CONSTEXPR months_type & operator+=(const months_type &);
  BOOST_CXX14_CONSTEXPR months_type operator-(const months_type &) const;
  BOOST_CXX14_CONSTEXPR months_type & operator-=(const months_type &);
  BOOST_CXX14_CONSTEXPR months_type operator *(const int_type) const;
  BOOST_CXX14_CONSTEXPR months_type & operator *=(const int_type);
  BOOST_CXX14_CONSTEXPR months_type operator/(const int_type) const;
  BOOST_CXX14_CONSTEXPR months_type & operator/=(const int_type);
  BOOST_CXX14_CONSTEXPR months_type operator+(const years_type &) const;
  BOOST_CXX14_CONSTEXPR months_type & operator+=(const years_type &);
  BOOST_CXX14_CONSTEXPR months_type operator-(const years_type &) const;
  BOOST_CXX14_CONSTEXPR months_type & operator-=(const years_type &);
};

Description

A logical month enables things like: "date(2002,Mar,2) + months(2) -> 2002-May2". If the date is a last day-of-the-month, the result will also be a last-day-of-the-month.

months_duration public construct/copy/destruct

  1. months_duration(int_rep num);
  2. months_duration(special_values sv);

months_duration public member functions

  1. int_rep number_of_months() const;
  2. BOOST_CXX14_CONSTEXPR duration_type get_neg_offset(const date_type & d) const;
    returns a negative duration
  3. BOOST_CXX14_CONSTEXPR duration_type get_offset(const date_type & d) const;
  4. BOOST_CONSTEXPR bool operator==(const months_type & rhs) const;
  5. BOOST_CONSTEXPR bool operator!=(const months_type & rhs) const;
  6. BOOST_CXX14_CONSTEXPR months_type operator+(const months_type & rhs) const;
  7. BOOST_CXX14_CONSTEXPR months_type & operator+=(const months_type & rhs);
  8. BOOST_CXX14_CONSTEXPR months_type operator-(const months_type & rhs) const;
  9. BOOST_CXX14_CONSTEXPR months_type & operator-=(const months_type & rhs);
  10. BOOST_CXX14_CONSTEXPR months_type operator *(const int_type rhs) const;
  11. BOOST_CXX14_CONSTEXPR months_type & operator *=(const int_type rhs);
  12. BOOST_CXX14_CONSTEXPR months_type operator/(const int_type rhs) const;
  13. BOOST_CXX14_CONSTEXPR months_type & operator/=(const int_type rhs);
  14. BOOST_CXX14_CONSTEXPR months_type operator+(const years_type & y) const;
  15. BOOST_CXX14_CONSTEXPR months_type & operator+=(const years_type & y);
  16. BOOST_CXX14_CONSTEXPR months_type operator-(const years_type & y) const;
  17. BOOST_CXX14_CONSTEXPR months_type & operator-=(const years_type & y);

PrevUpHomeNext