refactor: workaround to enable clang-16 compilation

This commit is contained in:
Mateusz Pusz
2023-08-25 21:15:00 +02:00
parent 974110646a
commit a2376b9b53
4 changed files with 24 additions and 0 deletions

View File

@@ -32,8 +32,12 @@ namespace mp_units {
template<Reference auto R, RepresentationOf<get_quantity_spec(R).character> Rep>
class quantity;
#if MP_UNITS_COMP_CLANG < 17
template<auto R, typename Rep>
#else
template<Reference auto R, typename Rep>
requires quantity<R, std::remove_cvref_t<Rep>>::_rep_safe_constructible_
#endif
[[nodiscard]] constexpr quantity<R, std::remove_cvref_t<Rep>> make_quantity(Rep&& v);
namespace detail {

View File

@@ -110,8 +110,12 @@ template<Reference auto R, PointOriginFor<get_quantity_spec(R)> auto PO,
RepresentationOf<get_quantity_spec(R).character> Rep>
class quantity_point;
#if MP_UNITS_COMP_CLANG < 17
template<auto PO, typename Q>
#else
template<PointOrigin auto PO, Quantity Q>
requires ReferenceOf<std::remove_const_t<decltype(Q::reference)>, PO.quantity_spec>
#endif
[[nodiscard]] constexpr quantity_point<Q::reference, PO, typename Q::rep> make_quantity_point(Q&& q);
namespace detail {

View File

@@ -325,8 +325,12 @@ public:
}
private:
#if MP_UNITS_COMP_CLANG < 17
template<auto R2, typename Rep2>
#else
template<Reference auto R2, typename Rep2>
requires quantity<R2, std::remove_cvref_t<Rep2>>::_rep_safe_constructible_
#endif
friend constexpr quantity<R2, std::remove_cvref_t<Rep2>> make_quantity(Rep2&&);
template<typename Value>
@@ -435,8 +439,12 @@ template<auto R1, typename Rep1, auto R2, typename Rep2>
}
// make_quantity
#if MP_UNITS_COMP_CLANG < 17
template<auto R, typename Rep>
#else
template<Reference auto R, typename Rep>
requires quantity<R, std::remove_cvref_t<Rep>>::_rep_safe_constructible_
#endif
[[nodiscard]] constexpr quantity<R, std::remove_cvref_t<Rep>> make_quantity(Rep&& v)
{
return quantity<R, std::remove_cvref_t<Rep>>(std::forward<Rep>(v));

View File

@@ -207,8 +207,12 @@ public:
}
private:
#if MP_UNITS_COMP_CLANG < 17
template<auto PO2, typename Q>
#else
template<PointOrigin auto PO2, Quantity Q>
requires ReferenceOf<std::remove_const_t<decltype(Q::reference)>, PO2.quantity_spec>
#endif
friend constexpr quantity_point<Q::reference, PO2, typename Q::rep> make_quantity_point(Q&&);
template<Quantity Q>
@@ -356,8 +360,12 @@ template<QuantityPoint QP1, QuantityPointOf<QP1::absolute_point_origin> QP2>
}
// make_quantity_point
#if MP_UNITS_COMP_CLANG < 17
template<auto PO, typename Q>
#else
template<PointOrigin auto PO, Quantity Q>
requires ReferenceOf<std::remove_const_t<decltype(Q::reference)>, PO.quantity_spec>
#endif
[[nodiscard]] constexpr quantity_point<Q::reference, PO, typename Q::rep> make_quantity_point(Q&& q)
{
return quantity_point<Q::reference, PO, typename Q::rep>(std::forward<Q>(q));