Boost logo

Boost :

Subject: Re: [boost] [chrono/date] year/day/week literals
From: Anders Dalvander (boost_at_[hidden])
Date: 2013-05-04 14:38:10


On 2013-05-03 12:01, Vicente J. Botet Escriba wrote:
> Hi,
>
> on the GSoC discussion about Boost.Chrono/Date proposal we were
> discussing about date construction.
> Some of us think that we need to use named types for day, month, year
> and week so that the date constructors are not ambiguous.
> 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.
>
> What do you think?
>
> Vicente
>

Do people actually hard code dates as often to make this necessary?

We don't need to do something just because we can, we should do
something that is useful and have a real life use case.

Regards,
Anders Dalvander


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