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


Class template year_based_generator

boost::date_time::year_based_generator — Base class for all generators that take a year and produce a date.


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

template<typename date_type> 
class year_based_generator {
  // types
  typedef date_type::calendar_type calendar_type;
  typedef calendar_type::year_type year_type;    

  // construct/copy/destruct
  virtual ~year_based_generator();

  // public member functions
  virtual date_type get_date(year_type) const = 0;
  virtual std::string to_string() const = 0;


This class is a base class for polymorphic function objects that take a year and produce a concrete date.

Template Parameters

  1. typename date_type

    The type representing a date. This type must export a calender_type which defines a year_type.

year_based_generator public construct/copy/destruct

  1. year_based_generator();
  2. virtual ~year_based_generator();

year_based_generator public member functions

  1. virtual date_type get_date(year_type y) const = 0;
  2. virtual std::string to_string() const = 0;
    Returns a string for use in a POSIX time_zone string.