[hacks] add MP_UNITS_IS_VALUE

This commit is contained in:
Jonas Hoppe committed 2024-09-03 12:14:42 +02:00
1 parent 5ae1304eee
commit a89bfc6c21
4 files changed
+13 -11

No files matched your search

+2
View File
@@ -81,11 +81,13 @@
#define MP_UNITS_TYPENAME typename
#define MP_UNITS_EXPRESSION(x) (x)
#define MP_UNITS_IS_VALUE(x) (x)
#else
#define MP_UNITS_TYPENAME
#define MP_UNITS_EXPRESSION(x) x
#define MP_UNITS_IS_VALUE(x)
#endif
@@ -41,7 +41,7 @@ template<Reference R>
struct delta_ {
template<typename Rep>
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{}).character>
[[nodiscard]] constexpr quantity<(R{}), std::remove_cvref_t<Rep>> operator()(Rep&& lhs) const
[[nodiscard]] constexpr quantity<MP_UNITS_EXPRESSION(R{}), std::remove_cvref_t<Rep>> operator()(Rep&& lhs) const
{
return quantity{std::forward<Rep>(lhs), R{}};
}
@@ -51,7 +51,7 @@ template<Reference R>
struct absolute_ {
template<typename Rep>
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{}).character>
[[nodiscard]] constexpr quantity_point<(R{}), default_point_origin(R{}), std::remove_cvref_t<Rep>> operator()(
[[nodiscard]] constexpr quantity_point<MP_UNITS_EXPRESSION(R{}), default_point_origin(R{}), std::remove_cvref_t<Rep>> operator()(
Rep&& lhs) const
{
return quantity_point{quantity{std::forward<Rep>(lhs), R{}}};