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>
|
template<class Handler, typename FormatContext>
|
||||||
[[nodiscard]] constexpr int get_dynamic_spec(int index, FormatContext& ctx)
|
[[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())) {
|
if (value > static_cast<unsigned long long>(std::numeric_limits<int>::max())) {
|
||||||
throw STD_FMT::format_error("number is too big");
|
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) {
|
if (p != begin) {
|
||||||
auto c = *begin;
|
auto c = *begin;
|
||||||
if (c == '{') return handler.on_error("invalid fill character '{'"), 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;
|
begin = p + 1;
|
||||||
} else
|
} else
|
||||||
++begin;
|
++begin;
|
||||||
|
@@ -240,7 +240,7 @@ template<typename CharT, typename Rep, typename OutputIt, typename Locale>
|
|||||||
|
|
||||||
// Creates a global format string
|
// Creates a global format string
|
||||||
// e.g. "{:*^10%.1Q_%q}, 1.23_q_m" => "{:*^10}"
|
// 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)
|
OutputIt format_global_buffer(OutputIt out, const quantity_global_format_specs<CharT>& specs)
|
||||||
{
|
{
|
||||||
STD_FMT::format_to(out, "{{:");
|
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,
|
template<typename Dimension, typename Unit, typename Rep, typename Locale, typename CharT,
|
||||||
std::output_iterator<CharT> OutputIt>
|
typename OutputIt>
|
||||||
struct quantity_formatter {
|
struct quantity_formatter {
|
||||||
OutputIt out;
|
OutputIt out;
|
||||||
Rep val;
|
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 begin = ctx.begin();
|
||||||
auto end = ctx.end();
|
auto end = ctx.end();
|
||||||
@@ -399,7 +399,7 @@ private:
|
|||||||
return {begin, end};
|
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)
|
OutputIt format_quantity_content(OutputIt out, const quantity& q, FormatContext& ctx)
|
||||||
{
|
{
|
||||||
auto begin = format_str.begin();
|
auto begin = format_str.begin();
|
||||||
@@ -409,7 +409,7 @@ private:
|
|||||||
// default format should print value followed by the unit separated with 1 space
|
// 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());
|
out = units::detail::format_units_quantity_value<CharT>(out, q.number(), specs.rep, ctx.locale());
|
||||||
constexpr auto symbol = units::detail::unit_text<Dimension, Unit>();
|
constexpr auto symbol = units::detail::unit_text<Dimension, Unit>();
|
||||||
if constexpr (symbol.standard().size()) {
|
if constexpr (symbol.standard().size() > 0) {
|
||||||
*out++ = CharT(' ');
|
*out++ = CharT(' ');
|
||||||
STD_FMT::format_to(out, "{}", symbol.standard().c_str());
|
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)
|
[[nodiscard]] constexpr auto parse(STD_FMT::basic_format_parse_context<CharT>& ctx)
|
||||||
{
|
{
|
||||||
auto range = do_parse(ctx);
|
auto range = do_parse(ctx);
|
||||||
format_str = std::basic_string_view<CharT>(range.begin(), range.end());
|
format_str = std::basic_string_view<CharT>(range.first, static_cast<size_t>(range.second - range.first));
|
||||||
return range.end();
|
return range.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename FormatContext>
|
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
|
#if UNITS_COMP_CLANG == 12
|
||||||
|
|
||||||
#include <concepts/concepts.hpp>
|
#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/lower_bound.hpp>
|
||||||
#include <range/v3/algorithm/transform.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
|
#elif UNITS_COMP_CLANG == 13 || UNITS_COMP_CLANG == 14
|
||||||
|
|
||||||
@@ -127,6 +128,10 @@ using concepts::totally_ordered;
|
|||||||
|
|
||||||
using ranges::compare_three_way;
|
using ranges::compare_three_way;
|
||||||
|
|
||||||
|
using ranges::forward_iterator;
|
||||||
|
using ranges::sentinel_for;
|
||||||
|
using ranges::iter_value_t;
|
||||||
|
|
||||||
namespace ranges {
|
namespace ranges {
|
||||||
|
|
||||||
using ::ranges::begin;
|
using ::ranges::begin;
|
||||||
|
Reference in New Issue
Block a user