Boost logo

Boost Users :

From: klapshin klapshin_at_[hidden])
Date: 2002-12-26 17:20:27


Hello,

I am an a process of adapting our codebase to boost date_time library, and one quite annoying problem I encountered is that date iterators conform to InputIterator model, rather then Random Access Iterator.

By the nature of application I have to calculate quite often something like current date plus N months.

The only way I see so far is doing something like

date d(2002,Dec,26);
month_iterator mi(d);
for( size_t i=0; i < 5; ++i)
    ++mi;
d = *mi;

This is rather awkward, not to mention inefficient.

I was trying to search both User and Developers mailing lists for "date InputIterator" hoping to find out what was the reason to use InputIterators, but no luck.

BTW, how am I supposed to roll few months back? It is a forward iterator not even a bidirectional.

Even more critique: the iterator is not exactly InputIterator, since it has only prefix increment, and no postfix one.

Best regards,
Kirill Lapshin.


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