mp_units::Dimension¶
A concept matching every dimension
Synopsis¶
Declared in <mp-units/framework/dimension_concepts.h>
template<typename T>
concept Dimension = detail::is_dimension<T>;
Description¶
Satisfied by a base dimension, which derives from base_dimension, and by a derived dimension, which the library computes from the equation of a quantity specification.
// whether each state variable of a Kalman filter is the time derivative of the one before it
template<Dimension auto... Ds>
constexpr bool are_time_derivatives = true;
template<Dimension auto D1, Dimension auto D2, Dimension auto... Ds>
constexpr bool are_time_derivatives<D1, D2, Ds...> =
(D1 / D2 == isq::dim_time) && are_time_derivatives<D2, Ds...>;
// the state of a Kalman filter: position, then its rate of change, then that rate's
template<QuantityPoint... QPs>
requires are_time_derivatives<QPs::dimension...>
class system_state;
// doesn't compile: not dimensions
// auto bad = are_time_derivatives<isq::length, isq::speed>;
// values of types nobody spells, so naming what each one is helps where `auto` alone doesn't
constexpr QuantitySpec auto power_spec = isq::energy / isq::duration;
constexpr Dimension auto power_dimension = get_dimension(power_spec);
constexpr Unit auto power_unit = si::joule / si::second;
constexpr Reference auto power_reference = power_spec[power_unit];
See Also¶
- Concepts in the User's Guide