From 45c4f2039b2fbee26e88971fceae39834f7a7b95 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 20 Jan 2024 14:43:40 +0800 Subject: [PATCH] cql3: add formatter for cql3::ut_name 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, we define a formatter for cql3::ut_name, and remove their operator<<(). Refs #13245 Signed-off-by: Kefu Chai Closes scylladb/scylladb#16890 --- cql3/ut_name.hh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cql3/ut_name.hh b/cql3/ut_name.hh index f73f612104..37860fabd3 100644 --- a/cql3/ut_name.hh +++ b/cql3/ut_name.hh @@ -12,6 +12,7 @@ #include #include +#include #include "seastarx.hh" #include "bytes.hh" @@ -38,10 +39,13 @@ public: sstring get_string_type_name() const; sstring to_cql_string() const; - - friend std::ostream& operator<<(std::ostream& os, const ut_name& n) { - return os << n.to_cql_string(); - } }; } + +template <> struct fmt::formatter { + constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } + auto format(const cql3::ut_name& n, fmt::format_context& ctx) const { + return fmt::format_to(ctx.out(), "{}", n.to_cql_string()); + } +};