From 9e42e1faca359cd6acf6e7a3ff951674ca364657 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Fri, 7 Jul 2023 09:36:08 +0200 Subject: [PATCH] feat: `quantity_point` can now be constructed faster from another one if they share the same `point_origin` --- src/core/include/mp-units/quantity_point.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/include/mp-units/quantity_point.h b/src/core/include/mp-units/quantity_point.h index 7c91f93b..76b92143 100644 --- a/src/core/include/mp-units/quantity_point.h +++ b/src/core/include/mp-units/quantity_point.h @@ -112,6 +112,14 @@ public: { } + template + requires std::constructible_from> + constexpr explicit(!std::convertible_to, quantity_type>) + quantity_point(const quantity_point& qp) : + q_(qp.relative()) + { + } + template QP> requires std::constructible_from constexpr explicit(!std::convertible_to) quantity_point(const QP& qp) :