Open jinay1991 opened 1 year ago
This is supported in the 3.0 series of releases. Consider backporting to 2.3.
Parts of this seems to got broken from 3.0.0 Beta to 3.0.0 Beta 2. The following code compiled on Beta, but does not compile on Beta 2 any more:
units::seconds<> s(0);
s += std::chrono::seconds(0);
The problem seems to got introduced with 26242aa0 where an additional overload for operator+=
with signature
template<class UnitTypeLhs, class T, std::enable_if_t<traits::is_unit_v<UnitTypeLhs> && !traits::is_unit_v<T>, int> = 0>
constexpr UnitTypeLhs& operator+=(UnitTypeLhs& lhs, T rhs) noexcept;
has been introduced. For std::chrono
types on the lhs, this operator now gets precedence and fails in finding the corresponding operator+
used in its implementation.
Feature Request for supporting implicit safe conversion of time units between
std::chrono
andunits::time
.Library used: v2.3.1 Compilers used: GCC v12, Clang v12