From 53ba5581070bc8914a35a5e16af901c562923e61 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Mon, 28 Aug 2023 18:05:23 +0200 Subject: fmt: Specialize formatter only for version >= 10 --- src/utils/cpp/json.hpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/utils/cpp/json.hpp') diff --git a/src/utils/cpp/json.hpp b/src/utils/cpp/json.hpp index 9fd2d66d..d83f30ed 100644 --- a/src/utils/cpp/json.hpp +++ b/src/utils/cpp/json.hpp @@ -21,6 +21,7 @@ #include #include +#include "fmt/core.h" #include "fmt/ostream.h" #include "gsl/gsl" #include "nlohmann/json.hpp" @@ -213,10 +214,12 @@ namespace detail { return old_abbrev; } +#if defined(FMT_VERSION) and FMT_VERSION >= 100000 // Use nlohmann::basic_json::operator<<() for formatting via libfmt. // This explicit template specialization seems to be required starting with // libfmt 10.x. template <> struct fmt::formatter> : ostream_formatter {}; +#endif #endif // INCLUDED_SRC_UTILS_CPP_JSON_HPP -- cgit v1.2.3