mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-07 06:04:27 +02:00
refactor: in(U)
and force_in(U)
now return auto
to provide better diagnostics on clang
When a strong type was returned clang, instead of on a concept check, failed on `detail::make_quantity` used to provide a function return type.
This commit is contained in:
@@ -144,14 +144,14 @@ public:
|
||||
// conversions
|
||||
template<UnitCompatibleWith<unit, quantity_spec> U>
|
||||
requires detail::QuantityConvertibleTo<quantity, quantity<detail::make_reference(quantity_spec, U{}), Rep>>
|
||||
[[nodiscard]] constexpr quantity<detail::make_reference(quantity_spec, U{}), Rep> in(U) const
|
||||
[[nodiscard]] constexpr Quantity auto in(U) const
|
||||
{
|
||||
return quantity<detail::make_reference(quantity_spec, U{}), Rep>{*this};
|
||||
}
|
||||
|
||||
template<UnitCompatibleWith<unit, quantity_spec> U>
|
||||
requires requires(quantity q) { value_cast<U{}>(q); }
|
||||
[[nodiscard]] constexpr quantity<detail::make_reference(quantity_spec, U{}), Rep> force_in(U) const
|
||||
[[nodiscard]] constexpr Quantity auto force_in(U) const
|
||||
{
|
||||
return value_cast<U{}>(*this);
|
||||
}
|
||||
|
@@ -170,14 +170,14 @@ public:
|
||||
|
||||
template<UnitCompatibleWith<unit, quantity_spec> U>
|
||||
requires detail::QuantityConvertibleTo<quantity_type, quantity<detail::make_reference(quantity_spec, U{}), Rep>>
|
||||
[[nodiscard]] constexpr quantity_point<detail::make_reference(quantity_spec, U{}), PO, Rep> in(U) const
|
||||
[[nodiscard]] constexpr QuantityPoint auto in(U) const
|
||||
{
|
||||
return make_quantity_point<PO>(quantity_ref_from(PO).in(U{}));
|
||||
}
|
||||
|
||||
template<UnitCompatibleWith<unit, quantity_spec> U>
|
||||
requires requires(quantity_type q) { value_cast<U{}>(q); }
|
||||
[[nodiscard]] constexpr quantity_point<detail::make_reference(quantity_spec, U{}), PO, Rep> force_in(U) const
|
||||
[[nodiscard]] constexpr QuantityPoint auto force_in(U) const
|
||||
{
|
||||
return make_quantity_point<PO>(quantity_ref_from(PO).force_in(U{}));
|
||||
}
|
||||
|
Reference in New Issue
Block a user