From a2b1fdd4c8c7c6c915ce98cb42217a0df0880f92 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 16 May 2023 13:44:13 +0200 Subject: [PATCH] feat: unit conversion operator added to `quantity_point` --- src/core/include/mp_units/quantity_point.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/include/mp_units/quantity_point.h b/src/core/include/mp_units/quantity_point.h index 96fdf890..c1654020 100644 --- a/src/core/include/mp_units/quantity_point.h +++ b/src/core/include/mp_units/quantity_point.h @@ -133,6 +133,13 @@ public: return point_origin.absolute() + relative(); } + template + requires detail::QuantityConvertibleTo{}, Rep>> + [[nodiscard]] constexpr quantity_point<::mp_units::reference{}, PO, Rep> operator[](U) const + { + return quantity_point{*this}; + } + // member unary operators constexpr quantity_point& operator++() requires requires { ++q_; }