C++ Logo

std-proposals

Advanced search

[std-proposals] std::chrono::duration default constructor

From: Federico Kircheis <federico_at_[hidden]>
Date: Wed, 3 Apr 2024 11:43:53 +0200
Hello,


I have a question about the default constructor of std::chrono::duration

For example std::chrono::duration::seconds

According to the standard, it has a default constructor, but the
standard does not specify to what value a default constructed duration
is set to object.


I found

https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/OcGX7Yj3meI

that argues that having an uninitialized duration is by design, which
follows the question if the standard be more explicit?

For me (and many colleagues) it was a surprise, as the presence of a
default constructor hinted that the type would be initialized.

I find the rationale weak, as I would have thought not having a default
constructor would have made much more sense, but it is obviously to late
to change that.

Received on 2024-04-03 09:43:59