mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-05 21:24:27 +02:00
build: fmt updated to 8.0.1
This commit is contained in:
@@ -37,7 +37,7 @@ class UnitsConan(ConanFile):
|
||||
url = "https://github.com/mpusz/units"
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
requires = (
|
||||
"fmt/7.1.3",
|
||||
"fmt/8.0.1",
|
||||
"gsl-lite/0.38.1"
|
||||
)
|
||||
options = {
|
||||
|
@@ -7,6 +7,7 @@
|
||||
- (!) fix: add `quantity_point::origin`, like `std::chrono::time_point::clock`
|
||||
- fix: account for different dimensions in `quantity_point_cast`'s constraint
|
||||
- build: Minimum Conan version changed to 1.40
|
||||
- build: fmt updated to 8.0.1
|
||||
- build: gsl-lite updated to 0.38.1
|
||||
- build: catch2 updated to 2.13.7
|
||||
- build: doxygen updated to 1.9.2
|
||||
|
@@ -44,7 +44,7 @@ template<typename Derived, typename Rep>
|
||||
struct coordinate {
|
||||
using value_type = Rep;
|
||||
constexpr explicit coordinate(value_type v) : value_(v) {}
|
||||
value_type value() const { return value_; }
|
||||
constexpr value_type value() const { return value_; }
|
||||
auto operator<=>(const coordinate&) const = default;
|
||||
private:
|
||||
value_type value_;
|
||||
@@ -110,7 +110,7 @@ struct fmt::formatter<geographic::latitude> : formatter<geographic::latitude::va
|
||||
template<typename FormatContext>
|
||||
auto format(geographic::latitude lat, FormatContext& ctx)
|
||||
{
|
||||
format_to(ctx.out(), lat.value() > 0 ? "N" : "S");
|
||||
format_to(ctx.out(), fmt::runtime(lat.value() > 0 ? "N" : "S"));
|
||||
return formatter<geographic::latitude::value_type>::format(lat.value() > 0 ? lat.value() : -lat.value(), ctx);
|
||||
}
|
||||
};
|
||||
@@ -120,7 +120,7 @@ struct fmt::formatter<geographic::longitude> : formatter<geographic::longitude::
|
||||
template<typename FormatContext>
|
||||
auto format(geographic::longitude lon, FormatContext& ctx)
|
||||
{
|
||||
format_to(ctx.out(), lon.value() > 0 ? "E" : "W");
|
||||
format_to(ctx.out(), fmt::runtime(lon.value() > 0 ? "E" : "W"));
|
||||
return formatter<geographic::longitude::value_type>::format(lon.value() > 0 ? lon.value() : -lon.value(), ctx);
|
||||
}
|
||||
};
|
||||
|
@@ -184,7 +184,8 @@ struct fmt::formatter<kalman::state<Qs...>> {
|
||||
units::detail::global_format_specs<char> global_specs = { specs.fill, specs.align, specs.width };
|
||||
units::detail::format_global_buffer(std::back_inserter(global_format_buffer), global_specs);
|
||||
|
||||
return format_to(ctx.out(), to_string(global_format_buffer), to_string(value_buffer));
|
||||
return format_to(ctx.out(), fmt::runtime(std::string_view(global_format_buffer.data(), global_format_buffer.size())),
|
||||
std::string_view(value_buffer.data(), value_buffer.size()));
|
||||
}
|
||||
private:
|
||||
detail::dynamic_format_specs<char> specs;
|
||||
@@ -221,7 +222,8 @@ struct fmt::formatter<kalman::estimation<Q>> {
|
||||
units::detail::global_format_specs<char> global_specs = { specs.fill, specs.align, specs.width };
|
||||
units::detail::format_global_buffer(std::back_inserter(global_format_buffer), global_specs);
|
||||
|
||||
return format_to(ctx.out(), to_string(global_format_buffer), to_string(value_buffer));
|
||||
return format_to(ctx.out(), fmt::runtime(std::string_view(global_format_buffer.data(), global_format_buffer.size())),
|
||||
std::string_view(value_buffer.data(), value_buffer.size()));
|
||||
}
|
||||
private:
|
||||
detail::dynamic_format_specs<char> specs;
|
||||
|
@@ -33,7 +33,6 @@ UNITS_DIAGNOSTIC_PUSH
|
||||
UNITS_DIAGNOSTIC_IGNORE_UNREACHABLE
|
||||
UNITS_DIAGNOSTIC_IGNORE_SHADOW
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/locale.h>
|
||||
UNITS_DIAGNOSTIC_POP
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
@@ -251,9 +250,9 @@ namespace units {
|
||||
}
|
||||
fmt::format_to(to_buffer, "}}");
|
||||
if (rep_specs.use_locale and static_cast<bool>(loc)) {
|
||||
return format_to(out, loc.template get<std::locale>(), fmt::to_string(buffer), val);
|
||||
return format_to(out, loc.template get<std::locale>(), fmt::runtime(std::string_view(buffer.data(), buffer.size())), val);
|
||||
}
|
||||
return format_to(out, fmt::to_string(buffer), val);
|
||||
return format_to(out, fmt::runtime(std::string_view(buffer.data(), buffer.size())), val);
|
||||
}
|
||||
|
||||
// Creates a global format string
|
||||
@@ -510,6 +509,6 @@ public:
|
||||
|
||||
// Format the `quantity buffer` using specs from `global_format_buffer`
|
||||
// In the example, equivalent to fmt::format("{:*^10}", "1.2_m")
|
||||
return format_to(ctx.out(), fmt::to_string(global_format_buffer), fmt::to_string(quantity_buffer));
|
||||
return format_to(ctx.out(), fmt::runtime(std::basic_string_view<CharT>(global_format_buffer.data(), global_format_buffer.size())), std::string_view(quantity_buffer.data(), quantity_buffer.size()));
|
||||
}
|
||||
};
|
||||
|
@@ -1034,12 +1034,12 @@ TEST_CASE("precision specification for integral representation should throw", "[
|
||||
{
|
||||
SECTION("full format {:%Q %q} on a quantity")
|
||||
{
|
||||
REQUIRE_THROWS_MATCHES(fmt::format("{:%.1Q %q}", 1_q_m), fmt::format_error, Message("precision not allowed for integral quantity representation"));
|
||||
REQUIRE_THROWS_MATCHES(fmt::format(fmt::runtime("{:%.1Q %q}"), 1_q_m), fmt::format_error, Message("precision not allowed for integral quantity representation"));
|
||||
}
|
||||
|
||||
SECTION("value only format {:%Q} on a quantity")
|
||||
{
|
||||
REQUIRE_THROWS_MATCHES(fmt::format("{:%.1Q}", 1_q_m), fmt::format_error, Message("precision not allowed for integral quantity representation"));
|
||||
REQUIRE_THROWS_MATCHES(fmt::format(fmt::runtime("{:%.1Q}"), 1_q_m), fmt::format_error, Message("precision not allowed for integral quantity representation"));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user