![]() |
BoB robotics
The Brains on Board robotics library
|
Functions used to convert values of one logical type to another. More...
Functions | |
template<typename T , typename Units , class = std::enable_if_t<std::is_arithmetic<T>::value && traits::is_unit_t<Units>::value>> | |
constexpr T | units::unit_cast (const Units &value) noexcept |
Casts a unit container to an arithmetic type. More... | |
Functions used to convert values of one logical type to another.
|
inlineconstexprnoexcept |
Casts a unit container to an arithmetic type.
unit_cast can be used to remove the strong typing from a unit class, and convert it to a built-in arithmetic type. This may be useful for compatibility with libraries and legacy code that don't support unit_t
types. E.g
T | Type to cast the unit type to. Must be a built-in arithmetic type. |
value | Unit value to cast. |