From ea09c0acb44e50e7044419eec7041a0052b8ec99 Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Sun, 16 Feb 2025 13:13:06 -0700 Subject: [PATCH] :arrow_up: Update libfmt Problem: - Specializing `fmt::formatter` is a lot of boilerplate. It also involves more template instantiations than necessary. Solution: - Use `format_as` instead. An overload found by ADL that compiles faster than instantiating formatter templates. --- CMakeLists.txt | 2 +- include/stdx/ct_format.hpp | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a83960..e448fa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ else() endif() add_versioned_package("gh:boostorg/mp11#boost-1.83.0") -fmt_recipe(10.2.1) +fmt_recipe(11.1.3) add_versioned_package("gh:intel/cpp-baremetal-concurrency#06e5901") if(NOT DEFINED CMAKE_CXX_STANDARD) diff --git a/include/stdx/ct_format.hpp b/include/stdx/ct_format.hpp index 9744ed8..9524f0a 100644 --- a/include/stdx/ct_format.hpp +++ b/include/stdx/ct_format.hpp @@ -19,17 +19,12 @@ #include #include -template -struct fmt::formatter> : fmt::formatter { - template - constexpr auto format(stdx::ct_string const &s, Ctx &ctx) const { - return fmt::formatter::format(std::string_view{s}, - ctx); - } -}; - namespace stdx { inline namespace v1 { +template constexpr auto format_as(stdx::ct_string const &s) { + return std::string_view{s}; +} + template struct format_result { CONSTEVAL static auto ct_string_convertible() -> std::bool_constant;