Boost logo

Boost :

Subject: Re: [boost] [chrono/date] year/day/week literals
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2013-05-04 15:22:05

On May 4, 2013, at 11:16 AM, TONGARI <tongari95_at_[hidden]> wrote:

> 2013/5/4 Rob Stewart <robertstewart_at_[hidden]>
>> On May 3, 2013, at 6:06 AM, "Vicente J. Botet Escriba" <
>> vicente.botet_at_[hidden]> wrote:
>>> Le 03/05/13 12:01, Vicente J. Botet Escriba a écrit :
>>>> Everyone agree with the constant object for month.
>>>> date dt(year(2013), may, day(3));
>>>> But having to use day(3) or year(2013) seems to wordy.
>>>> I was wondering if we can not add some literals for day, year and week
>> so that we can just write
>>>> date dt(2013y, may, 3d);
>>>> The advantage I see in addition to been less wordy, is that we will
>> have a compile error when the year, day or week is out of range.
>>> Oh I forget the drawbacks. As any other suffix it would need to add a
>> using statement
>>> using boost::chrono::dates::literals;
>> That alone negates the wordiness argument. Few will type "day()" enough
>> times, in a file, to offset that using directive.
>>> date dt(2013y, may, 3d);
>> The number first order, and need for an underscore, is ugly to me. I'd prefer constants of the form dayN to this.
> Unfortunately '_' is required by the standard for a user-defined literal.

That was my point. I was arguing against the user defined literals.


(Sent from my portable computation engine)

Boost list run by bdawes at, gregod at, cpdaniel at, john at