Boost logo

Boost :

Subject: Re: [boost] [gsoc 2013] draft proposal for chrono::date
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2013-05-03 07:52:45


On May 3, 2013, at 3:47 AM, "Vicente J. Botet Escriba" <vicente.botet_at_[hidden]> wrote:

>> You can even handle other orders that way:
>>
>> date(month, unsigned, year);
>> date(month, day, unsigned);
>> date(unsigned, day, month);
>> date(year, unsigned, month);
>>
>> One can also be explicit for both day and year:
>>
>> date(year, month, day);
>> date(month, day, year);
>> date(day, month, year);
>> date(day, year, month);
> I don't think that the constructor should support different orderings.

It could, easily, so why not? Different locales have different preferred orderings. All can learn to use the descending magnitude order, but a little flexibility, without ambiguity, would be nice.

>> I'm assuming explicit constructors for day and year, of course.
> Of course. And implicit conversion to his representation, so that
>
> date(2013, may, 3, no_check)
>
> is yet valid.

That's where I disagree. If you have explicit constructors for year and day, and no constructor accepting two ::rep arguments, then your example won't compile.

That's also what enables support for other argument orders.

> We could have a factory make_date function that doesn't checks the validity of the date and avoids the no_check parameter
>
> make_ymd_date(2013, may, 3)

I don't understand what no_check has to do with such a function. Add an overload that accepts no_check_t to get that.

___
Rob

(Sent from my portable computation engine)


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