Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2003-07-24 04:32:21


>
> > For instance, if I want to iterate 1 and a half days, I think it's more
> > expressive to say:
> >
> > time_iterator it( start, days(1) + hours( 12)) instead of:
> >
> > time_iterator it( start, hours( 36))
>
> It's pretty easy to add this yourself if you want:
>
> class days : public boost::posix_time::time_duration {
> days(int day_count) :
> boost::posix_time::time_duration(day_count*24, 0, 0)
> {}
> };
>
> I didn't compile it, but this should work...
>

Yes, indeed. Anyway, after looking at the overall picture, I don't think
it's such a good idea after all.
This is because of time_duration, since users might then expect .days()
to be there, which could even break some existing code.

> > Russell Hind wrote:
> > Why not days(1.5) then? That would be even easier, wouldn't it?
>
> Sure, but then we have to deal with rounding issues. To me the
> compactness of this is not worth the trouble it creates.

Yes, indeed. But using fixed-point decimals ;-)

Eventually you could do something like:

hours( one_day() );

or something similar.

I'll be back with more requests ;-)

Best,
John
>
> Jeff
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


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