Boost logo

Boost Users :

From: Luc Bergeron (bluc_at_[hidden])
Date: 2002-11-27 14:54:12


Hello everyone,

I was wondering, while looking at the source files, why the
date_iterator doesn't provide an operator--() ???

I've added this in the "date_iterator.hpp" file :

//---------------------------------------------------------
    date_itr_base& operator--()
    {
      current_ = current_ - get_offset(current_);
      return *this;
    }
//---------------------------------------------------------

I've rebuilt the library and done this little test :

//---------------------------------------------------------
#include <iostream>
#include <boost/date_time/gregorian/gregorian.hpp>

int main(void)
{
   using namespace boost::gregorian;

   date today = day_clock::local_day();
   day_iterator ditr(today, 1);
   int nbDaysToIterate = 360;

   for (;nbDaysToIterate != 0; --ditr, --nbDaysToIterate)
   {
      std::cout << to_iso_extended_string(*ditr) << std::endl;
   }
}
//---------------------------------------------------------

Everything seems to run OK. I've checked the february month and it has a
28th... Now I wonder why wasn't it included in the release ???

Cheers.

Luc Bergeron.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net