|
quanta 0.1.0
Type-safe units for temperature, frequency, electrical and spatial quantities, modeled after std::chrono
|
Operators relating length, area and volume. More...
Functions | |
| template<typename R1 , typename P1 , typename R2 , typename P2 > | |
| constexpr auto | quanta::spatial::operator* (const quantity< meter_unit, R1, P1 > &lhs, const quantity< meter_unit, R2, P2 > &rhs) |
| length x length = area. | |
| template<typename R1 , typename P1 , typename R2 , typename P2 > | |
| constexpr auto | quanta::spatial::operator* (const quantity< meter_unit, R1, P1 > &lhs, const quantity< square_meter_unit, R2, P2 > &rhs) |
| length x area = volume. | |
| template<typename R1 , typename P1 , typename R2 , typename P2 > | |
| constexpr auto | quanta::spatial::operator* (const quantity< square_meter_unit, R1, P1 > &lhs, const quantity< meter_unit, R2, P2 > &rhs) |
| area x length = volume. | |
| template<typename R1 , typename P1 , typename R2 , typename P2 > | |
| constexpr auto | quanta::spatial::operator/ (const quantity< square_meter_unit, R1, P1 > &lhs, const quantity< meter_unit, R2, P2 > &rhs) |
| area / length = length. | |
| template<typename R1 , typename P1 , typename R2 , typename P2 > | |
| constexpr auto | quanta::spatial::operator/ (const quantity< cubic_meter_unit, R1, P1 > &lhs, const quantity< meter_unit, R2, P2 > &rhs) |
| volume / length = area. | |
| template<typename R1 , typename P1 , typename R2 , typename P2 > | |
| constexpr auto | quanta::spatial::operator/ (const quantity< cubic_meter_unit, R1, P1 > &lhs, const quantity< square_meter_unit, R2, P2 > &rhs) |
| volume / area = length. | |
Operators relating length, area and volume.
Only these combinations are defined; any other product or quotient of quantities of different units (such as area x area or length / area) is ill-formed, as is adding or comparing quantities of different units.
The result precision is the product (or quotient) of the operand precisions and the representation is their common type, so products are exact for integer representations: feet(3) * feet(4) is exactly square_feet(12). Quotients divide the counts, so for integer representations they truncate in the result precision, which may be coarse when the operand precisions differ (square_meters(10) / millimeters(3) has kilometer precision and yields 3 km). Convert the operands to suitable precisions first, or use floating-point representations, for fractional results.
A product whose precision cannot be represented as a std::ratio (such as nanometers x nanometers x nanometers, 10⁻²⁷ m³) is a compile-time error.
|
constexpr |
length x length = area.
Definition at line 661 of file spatial.hpp.
|
constexpr |
length x area = volume.
Definition at line 667 of file spatial.hpp.
|
constexpr |
area x length = volume.
Definition at line 673 of file spatial.hpp.
|
constexpr |
volume / length = area.
Definition at line 685 of file spatial.hpp.
|
constexpr |
volume / area = length.
Definition at line 692 of file spatial.hpp.
|
constexpr |
area / length = length.
Definition at line 679 of file spatial.hpp.