Boost logo

Boost :

Subject: Re: [boost] [chrono/date] class names
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-05-11 19:13:17


Le 11/05/13 20:10, Howard Hinnant a écrit :
> On May 11, 2013, at 2:05 PM, "Vicente J. Botet Escriba" <vicente.botet_at_[hidden]> wrote:
>
>> A checked serial date is serial date that checks the validity at construction time, either from days or from an unchecked calendar_date. So the check could be on calendar dates which is more expensive.
> I understand what the check would look like from an unchecked calendar date. But what would you check when constructing a checked serial date from an unchecked days?
>
>
Well, nothing if we admit that the range would be large enough to don't
need validation. But

   checked::serial_date dt = may/11/year(2013);

would be the syntax to build a checked serial date converted from a
unchecked calendar date, and the validation would be done on the
conversion.

What do you think to using namespaces instead of prefixes?
This will allow to have checked and unchecked unit specifiers as well.

   using chrono::checked;
   serial_date dt = may/11/year(2013);

   using chrono::unchecked;
   serial_date dt = may/11/year(2013);

Just an idea.

Best,
Vicente


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