diff --git a/src/core/include/mp-units/quantity_point.h b/src/core/include/mp-units/quantity_point.h index 925c183a..f86f61fb 100644 --- a/src/core/include/mp-units/quantity_point.h +++ b/src/core/include/mp-units/quantity_point.h @@ -108,7 +108,7 @@ public: template requires std::constructible_from - constexpr explicit quantity_point(T&& v) : q_(std::forward(v)) + constexpr explicit quantity_point(T&& v, decltype(point_origin) = point_origin) : q_(std::forward(v)) { } @@ -230,6 +230,9 @@ public: template explicit quantity_point(Q) -> quantity_point{}, typename Q::rep>; +template +explicit quantity_point(Q, PO) -> quantity_point; + template explicit quantity_point(QP) -> quantity_point::reference, quantity_point_like_traits::point_origin, diff --git a/test/unit_test/static/quantity_point_test.cpp b/test/unit_test/static/quantity_point_test.cpp index becf1062..e3d47ec0 100644 --- a/test/unit_test/static/quantity_point_test.cpp +++ b/test/unit_test/static/quantity_point_test.cpp @@ -39,17 +39,15 @@ using sys_seconds = std::chrono::time_point { } mean_sea_level; -inline constexpr struct ground_level : - relative_point_origin{42 * isq::height[m]}> { +inline constexpr struct ground_level : relative_point_origin { } ground_level; -inline constexpr struct tower_peak : - relative_point_origin{42 * isq::height[m]}> { +inline constexpr struct tower_peak : relative_point_origin { } tower_peak; -inline constexpr struct everest_base_camp : - relative_point_origin{5364 * m}> { -} everest_base_camp; +inline constexpr struct other_ground_level : + relative_point_origin { +} other_ground_level; QUANTITY_SPEC(special_height, isq::height); QUANTITY_SPEC(activity, 1 / isq::time); @@ -492,6 +490,12 @@ static_assert(invalid_unit_conversion); // CTAD ///////// +static_assert(std::is_same_v, + absolute_point_origin>>); +static_assert(std::is_same_v, + std::remove_const_t>); +static_assert(std::is_same_v, + std::remove_const_t>); static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(quantity_point{123. * m}.unit == si::metre);