|
Boost : |
Subject: Re: [boost] [chrono] Interoperability with ICL and common concepts
From: Joachim Faulhaber (afojgo_at_[hidden])
Date: 2011-03-16 09:44:31
2011/3/16 Stewart, Robert <Robert.Stewart_at_[hidden]>:
> Joachim Faulhaber wrote:
>> 2011/3/15 Stewart, Robert <Robert.Stewart_at_[hidden]>:
>> > Joachim Faulhaber wrote:
>>
>> >> //=== in or under boost/chrono/chrono.hpp ==================
>> >>
>> >> namespace boost{namespace icl
>> >> {
>> >> template<class Type>struct identity_element;
>> >>
>> >> template<class Rep, class Period>
>> >> struct identity_element<boost::chrono::duration<Rep,Period> >
>> >> {
> [snip]
>> >> };
>> >> }}
>> >>
>> >> //==========================================================
>> >
>> > That looks pretty good, except perhaps instead of declaring
>> > identity_element in the chrono header,
>>
>> hmm, this was my c++ mini satori of the day, because I realized
>> authors of Boost.Chrono can avoid to do
>>
>> > it should
>> > include <boost/icl/identity_element.hpp>
>>
>> just that!
>>
>> Recall, I wanted ICL to be Chrono agnostic and Chrono to be
>> ICL agnostic.
>
> You make a good point, but I'd expect that the Chrono
> specialization would be in a special header that only ICL users
> would include.
You know how people are, particularly under time pressure. If things
don't work instantly, a high percentage abandons the effort and tries
something else. Some of those who don't give up will have difficulties
to find the clues for ICL-interoperability and the exact name of that
header file in the docs. Why imposing all that hassle on users, if the
interoperability, that doesn't need additional includes and no
customization points is so straight forward:
(1) A default constructor that is initialized with zero
(2) An increment/decrement on the least steppable unit
(3) A difference_type declaration
Very simple, very little effort, great benefit for instant
interoperability, not only with ICL but with all generic libraries
that depend on this minimal set of fundamental information.
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