mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 02:17:16 +02:00
refactor: examples refactored to benefit from the latest features
This commit is contained in:
@ -31,7 +31,7 @@ using namespace mp_units;
|
||||
|
||||
constexpr QuantityOf<isq::speed> auto avg_speed(QuantityOf<isq::distance> auto d, QuantityOf<isq::duration> auto t)
|
||||
{
|
||||
return quantity_cast<isq::speed>(d / t);
|
||||
return d / t;
|
||||
}
|
||||
|
||||
int main()
|
||||
@ -40,10 +40,10 @@ int main()
|
||||
using namespace mp_units::international::unit_symbols;
|
||||
|
||||
constexpr auto v1 = 110 * (km / h);
|
||||
constexpr auto v2 = 70. * mph;
|
||||
constexpr auto v3 = avg_speed(220 * km, 2 * h);
|
||||
constexpr auto v4 = avg_speed(140 * mi, 2 * h);
|
||||
constexpr auto v5 = value_cast<m / s>(v3);
|
||||
constexpr auto v2 = 70 * mph;
|
||||
constexpr auto v3 = avg_speed(220. * km, 2 * h);
|
||||
constexpr auto v4 = avg_speed(isq::distance(140. * mi), 2 * isq::duration[h]);
|
||||
constexpr auto v5 = v3[m / s];
|
||||
constexpr auto v6 = value_cast<m / s>(v4);
|
||||
constexpr auto v7 = value_cast<int>(v6);
|
||||
|
||||
|
Reference in New Issue
Block a user