mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
fix: clang compilation issues fixed
This commit is contained in:
@@ -164,7 +164,7 @@ template<typename CharT>
|
||||
template<class Handler, typename FormatContext>
|
||||
[[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<size_t>(index)));
|
||||
const unsigned long long value = STD_FMT::visit_format_arg(Handler{}, ctx.arg(FMT_TO_ARG_ID(static_cast<size_t>(index))));
|
||||
if (value > static_cast<unsigned long long>(std::numeric_limits<int>::max())) {
|
||||
throw STD_FMT::format_error("number is too big");
|
||||
}
|
||||
@@ -360,7 +360,7 @@ template<std::forward_iterator It, std::sentinel_for<It> 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<std::iter_value_t<It>>(begin, p));
|
||||
handler.on_fill(std::basic_string_view<std::iter_value_t<It>>(begin, static_cast<size_t>(p - begin)));
|
||||
begin = p + 1;
|
||||
} else
|
||||
++begin;
|
||||
|
@@ -240,7 +240,7 @@ template<typename CharT, typename Rep, typename OutputIt, typename Locale>
|
||||
|
||||
// Creates a global format string
|
||||
// e.g. "{:*^10%.1Q_%q}, 1.23_q_m" => "{:*^10}"
|
||||
template<typename CharT, std::output_iterator<CharT> OutputIt>
|
||||
template<typename CharT, typename OutputIt>
|
||||
OutputIt format_global_buffer(OutputIt out, const quantity_global_format_specs<CharT>& specs)
|
||||
{
|
||||
STD_FMT::format_to(out, "{{:");
|
||||
@@ -265,7 +265,7 @@ OutputIt format_global_buffer(OutputIt out, const quantity_global_format_specs<C
|
||||
}
|
||||
|
||||
template<typename Dimension, typename Unit, typename Rep, typename Locale, typename CharT,
|
||||
std::output_iterator<CharT> OutputIt>
|
||||
typename OutputIt>
|
||||
struct quantity_formatter {
|
||||
OutputIt out;
|
||||
Rep val;
|
||||
@@ -371,7 +371,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
[[nodiscard]] constexpr std::ranges::subrange<iterator> do_parse(STD_FMT::basic_format_parse_context<CharT>& ctx)
|
||||
[[nodiscard]] constexpr std::pair<iterator, iterator> do_parse(STD_FMT::basic_format_parse_context<CharT>& ctx)
|
||||
{
|
||||
auto begin = ctx.begin();
|
||||
auto end = ctx.end();
|
||||
@@ -399,7 +399,7 @@ private:
|
||||
return {begin, end};
|
||||
}
|
||||
|
||||
template<std::output_iterator<CharT> OutputIt, typename FormatContext>
|
||||
template<typename OutputIt, typename FormatContext>
|
||||
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<CharT>(out, q.number(), specs.rep, ctx.locale());
|
||||
constexpr auto symbol = units::detail::unit_text<Dimension, Unit>();
|
||||
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<CharT>& ctx)
|
||||
{
|
||||
auto range = do_parse(ctx);
|
||||
format_str = std::basic_string_view<CharT>(range.begin(), range.end());
|
||||
return range.end();
|
||||
format_str = std::basic_string_view<CharT>(range.first, static_cast<size_t>(range.second - range.first));
|
||||
return range.second;
|
||||
}
|
||||
|
||||
template<typename FormatContext>
|
||||
|
11
src/core/include/units/bits/external/hacks.h
vendored
11
src/core/include/units/bits/external/hacks.h
vendored
@@ -71,11 +71,12 @@
|
||||
#if UNITS_COMP_CLANG == 12
|
||||
|
||||
#include <concepts/concepts.hpp>
|
||||
#include <range/v3/functional/comparisons.hpp>
|
||||
#include <range/v3/iterator.hpp>
|
||||
#include <range/v3/range/concepts.hpp>
|
||||
#include <range/v3/algorithm/lower_bound.hpp>
|
||||
#include <range/v3/algorithm/transform.hpp>
|
||||
#include <range/v3/functional/comparisons.hpp>
|
||||
#include <range/v3/iterator.hpp>
|
||||
#include <range/v3/iterator/concepts.hpp>
|
||||
#include <range/v3/range/concepts.hpp>
|
||||
|
||||
#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;
|
||||
|
Reference in New Issue
Block a user