I just played with a simple example:
inline constexpr struct fuel_consumption final : quantity_spec<isq::volume / isq::length> {} fuel_consumption;
inline constexpr auto l_per_100km = si::litre / (mag<100> * si::kilo<si::metre>);
quantity q1 = 5.8 * l_per_100km;
quantity q2 = fuel_consumption(6.7 * l_per_100km);
static_assert(q1.dimension == isq::area.dimension);
static_assert(q2.dimension == isq::area.dimension);
static_assert(implicitly_convertible(q1.quantity_spec, isq::area));
static_assert(!castable(q2.quantity_spec, isq::area));
it was really nice until now, but then I noticed that I can do the following 😱:
quantity q3 = q1.in(m2);
quantity q4 = q2.in(m2);
quantity q5 = isq::area(42 * l_per_100km);
quantity<isq::area[m2]> q6 = 42 * l_per_100km;
Do we have any ideas on how to improve here?
I just played with a simple example:
it was really nice until now, but then I noticed that I can do the following 😱:
Do we have any ideas on how to improve here?