mirror of
https://github.com/mpusz/mp-units.git
synced 2025-06-25 01:01:33 +02:00
refactor: derived_kind
template parameters reordered to be compatible with a derived_unit
Resolves #229
This commit is contained in:
@ -77,7 +77,7 @@ you can use a quantity argument instead of a quantity kind.
|
||||
:emphasize-lines: 8-9
|
||||
|
||||
struct height_kind : kind<height_kind, dim_length> {};
|
||||
struct rate_of_climb_kind : derived_kind<rate_of_climb_kind, height_kind, dim_speed> {};
|
||||
struct rate_of_climb_kind : derived_kind<rate_of_climb_kind, dim_speed, height_kind> {};
|
||||
|
||||
template <Unit U, Representation Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
@ -90,7 +90,7 @@ you can use a quantity argument instead of a quantity kind.
|
||||
:emphasize-lines: 8-12
|
||||
|
||||
struct width_kind : kind<width_kind, dim_length> {};
|
||||
struct horizontal_area_kind : derived_kind<horizontal_area_kind, width_kind, dim_area> {};
|
||||
struct horizontal_area_kind : derived_kind<horizontal_area_kind, dim_area, width_kind> {};
|
||||
|
||||
template <Unit U, Representation Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using horizontal_area = quantity_kind<horizontal_area_kind, U, Rep>;
|
||||
|
@ -77,8 +77,8 @@ constexpr units::Dimensionless auto operator/(const QK1& lhs, const QK2& rhs)
|
||||
using horizontal_kind = geographic::horizontal_kind;
|
||||
struct vertical_kind : units::kind<vertical_kind, units::isq::si::dim_length> {};
|
||||
struct vertical_point_kind : units::point_kind<vertical_point_kind, vertical_kind> {};
|
||||
struct velocity_kind : units::derived_kind<velocity_kind, horizontal_kind, units::isq::si::dim_speed> {};
|
||||
struct rate_of_climb_kind : units::derived_kind<rate_of_climb_kind, vertical_kind, units::isq::si::dim_speed> {};
|
||||
struct velocity_kind : units::derived_kind<velocity_kind, units::isq::si::dim_speed, horizontal_kind> {};
|
||||
struct rate_of_climb_kind : units::derived_kind<rate_of_climb_kind, units::isq::si::dim_speed, vertical_kind> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Flight_planning#Units_of_measurement
|
||||
// length
|
||||
|
@ -54,7 +54,7 @@ using downcast_point_kind = downcast<detail::_point_kind_base<K>>;
|
||||
template<typename K, Dimension D>
|
||||
struct kind : downcast_dispatch<K, detail::_kind_base<K, D>> {};
|
||||
|
||||
template<typename DK, Kind BK, Dimension D>
|
||||
template<typename DK, Dimension D, Kind BK>
|
||||
requires std::same_as<BK, typename BK::base_kind>
|
||||
struct derived_kind : downcast_dispatch<DK, detail::_kind_base<BK, D>> {};
|
||||
|
||||
|
@ -151,7 +151,7 @@ static_assert(!equivalent<abscissa::_point_kind_base, horizontal_velocity>);
|
||||
|
||||
struct height : kind<height, dim_length> {};
|
||||
|
||||
struct rate_of_climb : derived_kind<rate_of_climb, height, dim_speed> {}; // program-defined derived kind
|
||||
struct rate_of_climb : derived_kind<rate_of_climb, dim_speed, height> {}; // program-defined derived kind
|
||||
struct velocity_of_climb : point_kind<velocity_of_climb, rate_of_climb> {}; // program-defined derived point kind
|
||||
|
||||
static_assert(Kind<rate_of_climb>);
|
||||
|
@ -52,8 +52,8 @@ struct radius_kind : kind<radius_kind, dim_length> {};
|
||||
struct width_kind : kind<width_kind, dim_length> {};
|
||||
struct height_kind : kind<height_kind, dim_length> {};
|
||||
|
||||
struct horizontal_area_kind : derived_kind<horizontal_area_kind, width_kind, dim_area> {};
|
||||
struct rate_of_climb_kind : derived_kind<rate_of_climb_kind, height_kind, dim_speed> {};
|
||||
struct horizontal_area_kind : derived_kind<horizontal_area_kind, dim_area, width_kind> {};
|
||||
struct rate_of_climb_kind : derived_kind<rate_of_climb_kind, dim_speed, height_kind> {};
|
||||
|
||||
struct apple : kind<apple, dim_one> {};
|
||||
struct orange : kind<orange, dim_one> {};
|
||||
|
@ -54,7 +54,7 @@ struct ordinate_kind : point_kind<ordinate_kind, height_kind> {};
|
||||
struct distance_kind : kind<distance_kind, dim_length> {};
|
||||
struct cgs_width_kind : kind<cgs_width_kind, cgs::dim_length> {};
|
||||
struct cgs_height_kind : kind<cgs_height_kind, cgs::dim_length> {};
|
||||
struct rate_of_climb_kind : derived_kind<rate_of_climb_kind, height_kind, dim_speed> {};
|
||||
struct rate_of_climb_kind : derived_kind<rate_of_climb_kind, dim_speed, height_kind> {};
|
||||
struct altitude_kind : point_kind<altitude_kind, cgs_height_kind> {};
|
||||
|
||||
struct apple : kind<apple, dim_one> {};
|
||||
|
Reference in New Issue
Block a user