mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 12:54:25 +02:00
fix: compiler crashes workaround
This commit is contained in:
@@ -108,7 +108,9 @@ template<Quantity To, typename FwdFrom, typename From = std::remove_cvref_t<FwdF
|
|||||||
constexpr Magnitude auto c_mag = get_canonical_unit(From::unit).mag / get_canonical_unit(To::unit).mag;
|
constexpr Magnitude auto c_mag = get_canonical_unit(From::unit).mag / get_canonical_unit(To::unit).mag;
|
||||||
using type_traits = conversion_type_traits<c_mag, typename From::rep, typename To::rep>;
|
using type_traits = conversion_type_traits<c_mag, typename From::rep, typename To::rep>;
|
||||||
using multiplier_type = typename type_traits::multiplier_type;
|
using multiplier_type = typename type_traits::multiplier_type;
|
||||||
auto scale = [&](std::invocable<typename type_traits::c_type> auto func) {
|
// TODO the below crashed nearly every compiler I tried it on
|
||||||
|
// auto scale = [&](std::invocable<typename type_traits::c_type> auto func) {
|
||||||
|
auto scale = [&](auto func) {
|
||||||
auto res =
|
auto res =
|
||||||
static_cast<To::rep>(func(static_cast<type_traits::c_type>(q.numerical_value_is_an_implementation_detail_)));
|
static_cast<To::rep>(func(static_cast<type_traits::c_type>(q.numerical_value_is_an_implementation_detail_)));
|
||||||
return To{res, To::reference};
|
return To{res, To::reference};
|
||||||
|
Reference in New Issue
Block a user