From a5d5cda79c0b4c71373a1a3451377972afa37324 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Mon, 25 Jul 2022 16:26:08 +0200 Subject: [PATCH] Implement ""_format operator ourselves instead of using from fmt The one in fmt is deprecated in version 8.1 and removed in version 9. This way we can keep the syntax and keep backwards compatibility for a while. --- src/format.hpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/format.hpp b/src/format.hpp index 291ac8113..b848c7355 100644 --- a/src/format.hpp +++ b/src/format.hpp @@ -13,7 +13,15 @@ #define FMT_HEADER_ONLY #include -// NOLINTNEXTLINE(google-global-names-in-headers,google-build-using-namespace) -using namespace fmt::literals; +inline auto operator"" _format(const char *s, std::size_t n) +{ + return [=](auto &&...args) { +#if FMT_VERSION < 80100 + return fmt::format(std::string_view{s, n}, args...); +#else + return fmt::format(fmt::runtime(std::string_view{s, n}), args...); +#endif + }; +} #endif // OSM2PGSQL_FORMAT_HPP