diff --git a/src/lib/fmt/SocketAddressFormatter.cxx b/src/lib/fmt/SocketAddressFormatter.cxx new file mode 100644 index 000000000..bd31f969c --- /dev/null +++ b/src/lib/fmt/SocketAddressFormatter.cxx @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann + +#include "SocketAddressFormatter.hxx" +#include "net/ToString.hxx" + +auto +fmt::formatter::format(SocketAddress address, format_context &ctx) + -> format_context::iterator +{ + return formatter::format(ToString(address), ctx); +} diff --git a/src/lib/fmt/SocketAddressFormatter.hxx b/src/lib/fmt/SocketAddressFormatter.hxx index 7a13bfce4..7020d9083 100644 --- a/src/lib/fmt/SocketAddressFormatter.hxx +++ b/src/lib/fmt/SocketAddressFormatter.hxx @@ -4,17 +4,18 @@ #pragma once #include "net/SocketAddress.hxx" -#include "net/ToString.hxx" #include #include -template T> -struct fmt::formatter : formatter +template<> +struct fmt::formatter : formatter +{ + auto format(SocketAddress address, format_context &ctx) -> format_context::iterator; +}; + +template T> +struct fmt::formatter : formatter { - template - auto format(SocketAddress address, FormatContext &ctx) { - return formatter::format(ToString(address), ctx); - } }; diff --git a/src/lib/fmt/meson.build b/src/lib/fmt/meson.build index f6b0243ee..b0237fd0a 100644 --- a/src/lib/fmt/meson.build +++ b/src/lib/fmt/meson.build @@ -11,6 +11,7 @@ endif fmt = static_library( 'fmt', 'RuntimeError.cxx', + 'SocketAddressFormatter.cxx', 'SystemError.cxx', include_directories: inc, dependencies: libfmt,