From 4607e69e24088552665d2c6fcba9087695d43eb6 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 5 May 2020 22:44:42 +0200 Subject: [PATCH] libfmt updated to 6.2.0 --- conanfile.py | 2 +- docs/CHANGELOG.md | 1 + src/include/units/format.h | 14 +++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/conanfile.py b/conanfile.py index 686a9dd8..056fca50 100644 --- a/conanfile.py +++ b/conanfile.py @@ -46,7 +46,7 @@ class UnitsConan(ConanFile): exports_sources = ["docs/*", "src/*", "test/*", "cmake/*", "example/*","CMakeLists.txt"] settings = "os", "compiler", "build_type", "arch" requires = ( - "fmt/6.1.0" + "fmt/6.2.0" ) # scm = { # "type": "git", diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ea0e2180..42f28df8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -20,6 +20,7 @@ - Output streams formatting support added - Linear algebra from `std::experimental::math` support added - Named SI units and their dimensions added (thanks [@rbrugo](https://github.com/rbrugo) + - libfmt updated to 6.2.0 - ... Many thanks to GitHub users [@oschonrock](https://github.com/oschonrock) and diff --git a/src/include/units/format.h b/src/include/units/format.h index 30fcbc54..8e2f068b 100644 --- a/src/include/units/format.h +++ b/src/include/units/format.h @@ -77,9 +77,9 @@ namespace units { template struct global_format_specs { - CharT fill = '\0'; + fmt::internal::fill_t fill = fmt::internal::fill_t::make(); fmt::align_t align = fmt::align_t::none; - int width = 0; + int width = 0; }; // Holds specs about the representation (%[specs]Q) @@ -314,9 +314,9 @@ private: } void on_error(const char* msg) { throw fmt::format_error(msg); } - constexpr void on_fill(CharT fill) { f.global_specs.fill = fill; } // global - constexpr void on_align(align_t align) { f.global_specs.align = align; } // global - constexpr void on_width(int width) { f.global_specs.width = width; } // global + constexpr void on_fill(basic_string_view fill) { f.global_specs.fill = fill; } // global + constexpr void on_align(align_t align) { f.global_specs.align = align; } // global + constexpr void on_width(int width) { f.global_specs.width = width; } // global constexpr void on_plus() { f.rep_specs.sign = fmt::sign::plus; } // rep constexpr void on_minus() { f.rep_specs.sign = fmt::sign::minus; } // rep constexpr void on_space() { f.rep_specs.sign = fmt::sign::space; } // rep @@ -427,8 +427,8 @@ public: fmt::basic_memory_buffer global_format_buffer; auto to_gfb = std::back_inserter(global_format_buffer); format_to(to_gfb, "{{:"); - if (auto fill = global_specs.fill; fill != '\0') { - format_to(to_gfb, "{}", fill); + if (global_specs.fill.size() != 1 || global_specs.fill[0] != ' ') { + format_to(to_gfb, "{}", global_specs.fill.data()); } if (auto align = global_specs.align; align != fmt::align_t::none) { switch (align) {