so we are able to format Payload using fmtlib v9. before fmtlib v9,
fmtlib is able to fall back to the operator<<() to format the the
types with the operator<<() defined. but after fmtlib v9, we need to
explicitly define them for accessing the specialized formatter.
now that we have specialized fmt::format<> for Payload, and the only
consumer of operator<<() is the fmtlib, we can safely drop the latter.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
};
WRITE_CLASS_DENC(Payload)
-std::ostream& operator<<(std::ostream& out, const Payload &pl)
-{
- return out << "reply=" << pl.who << " i = " << pl.seq;
-}
-
+template<>
+struct fmt::formatter<Payload> : fmt::formatter<std::string_view> {
+ template <typename FormatContext>
+ auto format(const Payload& pl, FormatContext& ctx) const {
+ return fmt::format_to(ctx.out(), "reply={} i={}", pl.who, pl.seq);
+ }
+};
namespace {