Boost logo

Boost :

From: Chris Trengove (trengove_at_[hidden])
Date: 2003-08-11 19:44:45


The date iterators in Boost Date-Time appear to be designed to support
iteration forward in time, being modelled on the STL InputIterator. However,
at times it is convenient to iterate backwards in time, and the temptation
is just to use something like

day_iterator ditr(date,-1);
++ditr;

that is; specify a negative "offset" as the optional construction parameter
which all four of the iterators provide.

This works for all of the provided iterators except the month_iterator, and
it wouldn't be too difficult to make that one work as well (by providing a
subtract() method for the wrapping_int2 template used in the
implementation).

Are there any other issues involved in providing this support for backwards
iteration?

Chris Trengove


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk