From 82a6f9e40b66dccca225a97202f4e8fce1b193cd Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Sat, 19 Oct 2024 05:18:16 +0600 Subject: [PATCH] Update `fmt` Formatters for Compatibility with Versions below 11 (#3172) --- include/openmc/output.h | 10 +++++++--- include/openmc/position.h | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/openmc/output.h b/include/openmc/output.h index 549d2ae32ba..940ea78ceb9 100644 --- a/include/openmc/output.h +++ b/include/openmc/output.h @@ -76,10 +76,14 @@ struct formatter> { } template - auto format(const std::array& arr, FormatContext& ctx) const +#if FMT_VERSION >= 110000 // Version 11.0.0 and above + auto format(const std::array& arr, FormatContext& ctx) const { +#else // For versions below 11.0.0 + auto format(const std::array& arr, FormatContext& ctx) { +#endif return format_to(ctx.out(), "({}, {})", arr[0], arr[1]); - } -}; +} +}; // namespace fmt } // namespace fmt diff --git a/include/openmc/position.h b/include/openmc/position.h index e6939dc0e46..dc60ab35a04 100644 --- a/include/openmc/position.h +++ b/include/openmc/position.h @@ -221,12 +221,16 @@ namespace fmt { template<> struct formatter : formatter { template - auto format(const openmc::Position& pos, FormatContext& ctx) const +#if FMT_VERSION >= 110000 // Version 11.0.0 and above + auto format(const openmc::Position& pos, FormatContext& ctx) const { +#else // For versions below 11.0.0 + auto format(const openmc::Position& pos, FormatContext& ctx) { +#endif return formatter::format( fmt::format("({}, {}, {})", pos.x, pos.y, pos.z), ctx); - } -}; +} +}; // namespace fmt } // namespace fmt