C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: std::chrono: intend of op-/ for std:.chrono::day
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2020-01-16 08:59:35


On Thu, 16 Jan 2020 at 16:50, Wilhelm Meier via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> Hi all,
>
> just stumbled across the following:
>
> auto t1 = 12s / 3;
> auto t2 = 12d / 3;
>
> t1 gives a duration of 3 seconds (reasonable, but t2 gives 12th of march.
>
> Is this intentional?
>
> I know, that 12s is a duration, and 12d is a timepoint. But for the
> careless reader, this is counter-intuitive.

Yes, it's intentional, and allows you to write things like 12d/3/2020y.


STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups