Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-08-14 22:17:24


On Fri, 15 Aug 2003 12:36:52 +1000, Chris Trengove wrote

> I think the big issue in using random access iterators is whether
> you want to support the difference concept. It is relatively
> straightforward to implement, say
>
> year_iterator i(date(2003,1,1));
> year_iterator j(date(2005,1,1));
> cout << j - i; // prints "2"

Right.
 
> but how do you handle the case when the dates are not neatly aligned
> on the places where the iterator would normally put them?

Ok. But I suspect day_iterators and time_iterators would probably be ok.
month_iterators would be a problem...

 
> Your period concept supports the merge (ie. union) function, which returns
> an empty period if there is no intersection. I also have a need for a
> function returning the actual [earliest,latest) of the two periods,
> regardless of whether they intersect. Obviously, this is trival to
> write, but it would be nice if the concept was included in the library.

Sure, can do. What would you call it: merge_inclusive, earliest_latest, rename
merge to union and call it merge, something else?

Jeff


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