From 0ac6a1701d2eb64c97c5f3adaa9ea2a118488c68 Mon Sep 17 00:00:00 2001 From: Nebojsa Cvetkovic Date: Mon, 1 Jul 2024 18:24:03 +0100 Subject: [PATCH] fix: Support fmtlib 11.0.0 --- src/core/include/mp-units/bits/fmt.h | 4 ++++ src/core/include/mp-units/format.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/include/mp-units/bits/fmt.h b/src/core/include/mp-units/bits/fmt.h index e48b39e7..186f0ae2 100644 --- a/src/core/include/mp-units/bits/fmt.h +++ b/src/core/include/mp-units/bits/fmt.h @@ -146,7 +146,11 @@ template template [[nodiscard]] constexpr int get_dynamic_spec(FormatArg arg) { +#if defined MP_UNITS_USE_FMTLIB && FMT_VERSION >= 110000 + const unsigned long long value = arg.visit(Handler{}); +#else const unsigned long long value = MP_UNITS_STD_FMT::visit_format_arg(Handler{}, arg); +#endif if (value > ::mp_units::detail::to_unsigned(std::numeric_limits::max())) { MP_UNITS_THROW(MP_UNITS_STD_FMT::format_error("number is too big")); } diff --git a/src/core/include/mp-units/format.h b/src/core/include/mp-units/format.h index 5e017cc8..c9684018 100644 --- a/src/core/include/mp-units/format.h +++ b/src/core/include/mp-units/format.h @@ -467,8 +467,8 @@ public: return parse_defaults_specs(it, end); } - template - OutIt format(const quantity_t& q, MP_UNITS_STD_FMT::basic_format_context& ctx) const + template + auto format(const quantity_t& q, FormatContext& ctx) const { auto specs = specs_; mp_units::detail::handle_dynamic_spec(specs.width, specs.width_ref, ctx);