|
|
От: | reversecode | |
| Дата: | 11.08.23 19:26 | ||
| Оценка: | |||
std::chrono::hours h(5);
std::chrono::seconds s(h); //ok
std::chrono::hours hh(s); //errortemplate< class Rep2, class Period2 >
constexpr duration( const duration<Rep2,Period2>& d );
Constructs a new duration from one of several optional data sources.
4) Constructs a duration by converting d to an appropriate period and tick count, as if by std::chrono::duration_cast<duration>(d).count(). In order to prevent truncation during conversion, this constructor only participates in overload resolution if computation of the conversion factor (by std::ratio_divide<Period2, Period>) does not overflow and:
or both:
std::ratio_divide<Period2, period>::den == 1, and
std::chrono::treat_as_floating_point<Rep2>::value == false.