Releases: jansende/benri
Releases · jansende/benri
Patch
Made simple_cast and unit_cast more versatile
- Changed
simple_cast
andunit_cast
both from a function to a functor. - Both functions are now more versatile than before. The following signatures are provided:
simple_cast<NewQuantity>(Quantity)
convertsQuantity
toNewQuantity
.simple_cast<NewQuantityPoint>(QuantityPoint)
convertsQuantity
to
NewQuantityPoint
.simple_cast<Unit>(Quantity)
converts the unit ofQuantity
toUnit
without
changing thevalue_type
.simple_cast<Unit>(QuantityPoint)
converts the unit ofQuantityPoint
toUnit
without changing thevalue_type
.simple_cast<ValueType>(Quantity)
converts thevalue_type
ofQuantity
to
ValueType
without changing the unit.simple_cast<ValueType>(QuantityPoint)
converts thevalue_type
ofQuantityPoint
toValueType
without changing the unit.simple_cast<NewQuantity, ValueType>(Quantity)
convertsQuantity
tounit_type
of
NewQuantity
and avalue_type
ofValueType
.simple_cast<NewQuantityPoint, ValueType>(QuantityPoint)
convertsQuantityPoint
to
unit_type
ofNewQuantityPoint
and avalue_type
ofValueType
.simple_cast<ValueType, NewQuantity>(Quantity)
convertsQuantity
tounit_type
of
NewQuantity
and avalue_type
ofValueType
.simple_cast<ValueType, NewQuantityPoint>(QuantityPoint)
convertsQuantityPoint
to
unit_type
ofNewQuantityPoint
and avalue_type
ofValueType
.simple_cast<Unit, ValueType>(Quantity)
converts the unit ofQuantity
toUnit
and
thevalue_type
toValueType
.simple_cast<Unit, ValueType>(QuantityPoint)
converts the unit ofQuantityPoint
to
Unit
and thevalue_type
toValueType
.simple_cast<ValueType, Unit>(Quantity)
converts the unit ofQuantity
toUnit
and
thevalue_type
toValueType
.simple_cast<ValueType, Unit>(QuantityPoint)
converts the unit ofQuantityPoint
to
Unit
and thevalue_type
toValueType
.
- Deprecated
value_type_cast
because the same functionality is now provided by
simple_cast
.
Patch
- Older MSVC versions had problems compiling benri due to template specialization
instantiation issues. (For a proper resolution MSVC would have needed to expand certain
template but did not.) - Fixed by adding
decltype(T{})
inside the specializations. - Made the
is_convertible_into
more general. (It now removesconst
andvolatile
before type comparison.)
Second release
This is the second full release of benri. The library was improved by adding <chrono>
support, fixing bugs and implementing more unit tests. Besides quality of life updates, bug fixing, and more unit tests, this seems to be the final version of benri. No further, compatibility breaking upgrades are planned for the future.
<chrono> support
- benri now supports interaction with the
<chrono>
library. - In order to be forward-compatible with the C++20 version of
<chrono>
, the month and
year types had to be be modified:month_t
is nowcalendar_month_t
with a length of 2.592×10⁶ s.year_t
is nowcalendar_year_t
with a length of 3.155 760×10⁷ s.month_t
maps now to the newgregorian_month_t
with a length of 2.629 746×10⁶ s.year_t
maps now to the newgregorian_year_t
with a length of 3.155 695 2×10⁷ s.- Because
lightyear_t
is a function ofyear_t
it slightly changes as well.
Patch
New type conversion system
- Replaced the
is_compatible
with the newconvert
struct. - The struct still provides a check if units should be implicitly convertible.
- It now additionally handles the actual conversion.
- This now allows us to interact with non benri types.
Improved temperatures
- Added unit test for temperature conversion.
- Added unit test for affine units (via temperatures).
- Added the
absolute_zero
constant.
Minor patch
- Improved cmake settings.
Minor patch
- Fixed floating point conversion warning inside static_assert.