mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
refactor: point_from
renamed to point_for
This commit is contained in:
@@ -140,7 +140,7 @@ public:
|
|||||||
quantity_point& operator=(quantity_point&&) = default;
|
quantity_point& operator=(quantity_point&&) = default;
|
||||||
|
|
||||||
template<PointOriginFor<quantity_spec> NewPO>
|
template<PointOriginFor<quantity_spec> NewPO>
|
||||||
[[nodiscard]] constexpr QuantityPointOf<NewPO{}> auto point_from(NewPO new_origin) const
|
[[nodiscard]] constexpr QuantityPointOf<NewPO{}> auto point_for(NewPO new_origin) const
|
||||||
{
|
{
|
||||||
if constexpr (is_same_v<NewPO, std::remove_const_t<decltype(point_origin)>>)
|
if constexpr (is_same_v<NewPO, std::remove_const_t<decltype(point_origin)>>)
|
||||||
return *this;
|
return *this;
|
||||||
|
@@ -556,19 +556,19 @@ static_assert(quantity_point<isq::height[m], ground_level>(tower_peak + 42 * m).
|
|||||||
static_assert(quantity_point<isq::height[m], tower_peak>(mean_sea_level + 42 * m).quantity_from_origin() == -42 * m);
|
static_assert(quantity_point<isq::height[m], tower_peak>(mean_sea_level + 42 * m).quantity_from_origin() == -42 * m);
|
||||||
static_assert(quantity_point<isq::height[m], tower_peak>(ground_level + 84 * m).quantity_from_origin() == 42 * m);
|
static_assert(quantity_point<isq::height[m], tower_peak>(ground_level + 84 * m).quantity_from_origin() == 42 * m);
|
||||||
|
|
||||||
static_assert((mean_sea_level + 42 * m).point_from(mean_sea_level).quantity_from_origin() == 42 * m);
|
static_assert((mean_sea_level + 42 * m).point_for(mean_sea_level).quantity_from_origin() == 42 * m);
|
||||||
static_assert((ground_level + 42 * m).point_from(mean_sea_level).quantity_from_origin() == 84 * m);
|
static_assert((ground_level + 42 * m).point_for(mean_sea_level).quantity_from_origin() == 84 * m);
|
||||||
static_assert((tower_peak + 42 * m).point_from(mean_sea_level).quantity_from_origin() == 126 * m);
|
static_assert((tower_peak + 42 * m).point_for(mean_sea_level).quantity_from_origin() == 126 * m);
|
||||||
|
|
||||||
static_assert((ground_level + 84 * m).point_from(ground_level).quantity_from_origin() == 84 * m);
|
static_assert((ground_level + 84 * m).point_for(ground_level).quantity_from_origin() == 84 * m);
|
||||||
static_assert((mean_sea_level + 84 * m).point_from(ground_level).quantity_from_origin() == 42 * m);
|
static_assert((mean_sea_level + 84 * m).point_for(ground_level).quantity_from_origin() == 42 * m);
|
||||||
static_assert((tower_peak + 42 * m).point_from(ground_level).quantity_from_origin() == 84 * m);
|
static_assert((tower_peak + 42 * m).point_for(ground_level).quantity_from_origin() == 84 * m);
|
||||||
|
|
||||||
static_assert((tower_peak + 42 * m).point_from(tower_peak).quantity_from_origin() == 42 * m);
|
static_assert((tower_peak + 42 * m).point_for(tower_peak).quantity_from_origin() == 42 * m);
|
||||||
static_assert((mean_sea_level + 42 * m).point_from(tower_peak).quantity_from_origin() == -42 * m);
|
static_assert((mean_sea_level + 42 * m).point_for(tower_peak).quantity_from_origin() == -42 * m);
|
||||||
static_assert((ground_level + 84 * m).point_from(tower_peak).quantity_from_origin() == 42 * m);
|
static_assert((ground_level + 84 * m).point_for(tower_peak).quantity_from_origin() == 42 * m);
|
||||||
|
|
||||||
static_assert(is_of_type<(ground_level + isq::height(short(42) * m)).point_from(mean_sea_level),
|
static_assert(is_of_type<(ground_level + isq::height(short(42) * m)).point_for(mean_sea_level),
|
||||||
quantity_point<isq::height[m], mean_sea_level, int>>);
|
quantity_point<isq::height[m], mean_sea_level, int>>);
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user