Boost logo

Boost :

Subject: Re: [boost] [chrono] Interoperability with ICL and common concepts
From: Joachim Faulhaber (afojgo_at_[hidden])
Date: 2011-03-16 08:50:53


2011/3/15 Howard Hinnant <howard.hinnant_at_[hidden]>:
> On Mar 15, 2011, at 2:00 PM, Vicente Botet wrote:
>
> The current std::chrono::duration default constructor has this definition:
>
> constexpr duration() = default;

hmm, I'm a little confused now

> The rationale for this is to give the client and the Rep author as many options as possible:
>
> typedef std::chrono::duration<long long> D;
>
> D d1;  // d1.count() uninitialized - speed
> D d2 = D();  // d2.count() zero-initialized - safety if you believe 0 is safe

This behavior is exactly what I desire

> typedef std::chrono::duration<BigInt> CustomD;
>
> CustomD d3; // d3.count() default constructed

But the current implementation of Boost.Chrono does not work like that:

typedef std::chrono::duration<long long> D;
D d2 = D(); // d2.count() UNINITIALIZED

Will the semantics of

> constexpr duration() = default;

implement the proposed behavior with the new standard?

Regards,
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