diff --git a/src/core-fmt/include/units/bits/fmt.h b/src/core-fmt/include/units/bits/fmt.h index e7984706..b0e5d536 100644 --- a/src/core-fmt/include/units/bits/fmt.h +++ b/src/core-fmt/include/units/bits/fmt.h @@ -164,7 +164,7 @@ template template [[nodiscard]] constexpr int get_dynamic_spec(int index, FormatContext& ctx) { - const unsigned long long value = STD_FMT::visit_format_arg(Handler{}, ctx.arg(static_cast(index))); + const unsigned long long value = STD_FMT::visit_format_arg(Handler{}, ctx.arg(FMT_TO_ARG_ID(static_cast(index)))); if (value > static_cast(std::numeric_limits::max())) { throw STD_FMT::format_error("number is too big"); } @@ -360,7 +360,7 @@ template S, typename Handler> if (p != begin) { auto c = *begin; if (c == '{') return handler.on_error("invalid fill character '{'"), begin; - handler.on_fill(std::basic_string_view>(begin, p)); + handler.on_fill(std::basic_string_view>(begin, static_cast(p - begin))); begin = p + 1; } else ++begin; diff --git a/src/core-fmt/include/units/format.h b/src/core-fmt/include/units/format.h index 3703f556..4b6d85ed 100644 --- a/src/core-fmt/include/units/format.h +++ b/src/core-fmt/include/units/format.h @@ -240,7 +240,7 @@ template // Creates a global format string // e.g. "{:*^10%.1Q_%q}, 1.23_q_m" => "{:*^10}" -template OutputIt> +template OutputIt format_global_buffer(OutputIt out, const quantity_global_format_specs& specs) { STD_FMT::format_to(out, "{{:"); @@ -265,7 +265,7 @@ OutputIt format_global_buffer(OutputIt out, const quantity_global_format_specs OutputIt> + typename OutputIt> struct quantity_formatter { OutputIt out; Rep val; @@ -371,7 +371,7 @@ private: } }; - [[nodiscard]] constexpr std::ranges::subrange do_parse(STD_FMT::basic_format_parse_context& ctx) + [[nodiscard]] constexpr std::pair do_parse(STD_FMT::basic_format_parse_context& ctx) { auto begin = ctx.begin(); auto end = ctx.end(); @@ -399,7 +399,7 @@ private: return {begin, end}; } - template OutputIt, typename FormatContext> + template OutputIt format_quantity_content(OutputIt out, const quantity& q, FormatContext& ctx) { auto begin = format_str.begin(); @@ -409,7 +409,7 @@ private: // default format should print value followed by the unit separated with 1 space out = units::detail::format_units_quantity_value(out, q.number(), specs.rep, ctx.locale()); constexpr auto symbol = units::detail::unit_text(); - if constexpr (symbol.standard().size()) { + if constexpr (symbol.standard().size() > 0) { *out++ = CharT(' '); STD_FMT::format_to(out, "{}", symbol.standard().c_str()); } @@ -425,8 +425,8 @@ public: [[nodiscard]] constexpr auto parse(STD_FMT::basic_format_parse_context& ctx) { auto range = do_parse(ctx); - format_str = std::basic_string_view(range.begin(), range.end()); - return range.end(); + format_str = std::basic_string_view(range.first, static_cast(range.second - range.first)); + return range.second; } template diff --git a/src/core/include/units/bits/external/hacks.h b/src/core/include/units/bits/external/hacks.h index 6895f63c..5d413751 100644 --- a/src/core/include/units/bits/external/hacks.h +++ b/src/core/include/units/bits/external/hacks.h @@ -71,11 +71,12 @@ #if UNITS_COMP_CLANG == 12 #include -#include -#include -#include #include #include +#include +#include +#include +#include #elif UNITS_COMP_CLANG == 13 || UNITS_COMP_CLANG == 14 @@ -127,6 +128,10 @@ using concepts::totally_ordered; using ranges::compare_three_way; +using ranges::forward_iterator; +using ranges::sentinel_for; +using ranges::iter_value_t; + namespace ranges { using ::ranges::begin;