From 8dacec589dd22d8a75b6d4e6a23cde51bbfaeb02 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 21 Mar 2024 13:38:16 +0800 Subject: [PATCH] cql3: add fmt::formatter for cql3_type and cql3_type::raw before this change, we rely on the default-generated fmt::formatter created from operator<<, but fmt v10 dropped the default-generated formatter. in this change, `fmt::formatter<>` is added for following classes: * `cql3::cql3_type` * `cql3::cql3_type::raw` Refs #13245 Signed-off-by: Kefu Chai Closes scylladb/scylladb#17945 --- cql3/cql3_type.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cql3/cql3_type.hh b/cql3/cql3_type.hh index 911e1aeac0..17739c1ca6 100644 --- a/cql3/cql3_type.hh +++ b/cql3/cql3_type.hh @@ -363,3 +363,17 @@ inline bool operator==(const cql3_type& a, const cql3_type& b) { #endif } + +template <> +struct fmt::formatter: fmt::formatter { + auto format(const cql3::cql3_type& t, fmt::format_context& ctx) const { + return formatter::format(format_as(t), ctx); + } +}; + +template T> +struct fmt::formatter: fmt::formatter { + auto format(const T& t, fmt::format_context& ctx) const { + return formatter::format(format_as(t), ctx); + } +};