|
Boost : |
Subject: Re: [boost] [chrono] Interoperability with ICL and common concepts
From: Joachim Faulhaber (afojgo_at_[hidden])
Date: 2011-03-16 11:54:13
2011/3/16 Howard Hinnant <howard.hinnant_at_[hidden]>:
> On Mar 16, 2011, at 10:47 AM, Joachim Faulhaber wrote:
>
>>>>> D d2 = D(); // d2.count() zero-initialized - safety if you believe 0 is safe
>>
>> BTW, I don't care for safety here at all. From my point of view I need
>> some minimal information from an unknown type T to be able to express
>> basic things like
>>
>> 0 < 1
>>
>> where 0 and 1 are not available as literals or atomic expressions for T.
>
> <nod> This is pretty much the rationale for duration_values<Rep>::zero().
> There does not exist a duration_values<Rep>::one()
I don't need a one() value if I get ++
T zero = T();
T one = T();
++one;
zero < one
therefore I'd like to have it ;)
> mainly because the standardization of the <chrono> library was very
> difficult, with many interested parties, and one of the ways to get
> something like that done is to propose as little as possible. We
> didn't absolutely need one() to get timed sleeping and waiting going,
> and we had to keep the thread library as the main client of <chrono>,
> lest consensus would not have been achieved. Things like one()
> might be added via a future TR and/or standard.
I've found that
template<class T>struct identity_element{...};
template<class T>struct unit_element{...};
are useful generalizations of zero and one. And I think that an
interval container library is not an adequate location for them.
> I'm already warming up my favorite additions for <chrono>. :-)
>
> http://home.roadrunner.com/~hinnant/duration_io/chrono_io.html
> http://home.roadrunner.com/~hinnant/duration_io/chrono_util.html
Good luck for them :)
Joachim
-- Interval Container Library [Boost.Icl] http://www.joachim-faulhaber.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk