From 2eb363297b24cd71a68ccfb20ff755430f17e60f Mon Sep 17 00:00:00 2001 From: frank-weinberg <34135287+frank-weinberg@users.noreply.github.com> Date: Fri, 19 Jan 2024 17:14:48 +0100 Subject: [PATCH] Fix custom formatter example (#3820) Add a return type declaration so the example builds when the formatter is used in a different compilation unit than it's implemented. --- doc/api.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/api.rst b/doc/api.rst index 7b16b0644321..ca193bda3978 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -139,14 +139,16 @@ without implementing them yourself. For example:: template <> struct fmt::formatter: formatter { // parse is inherited from formatter. - auto format(color c, format_context& ctx) const; + auto format(color c, format_context& ctx) const + -> format_parse_context::iterator; }; // color.cc: #include "color.h" #include - auto fmt::formatter::format(color c, format_context& ctx) const { + auto fmt::formatter::format(color c, format_context& ctx) const + -> format_parse_context::iterator { string_view name = "unknown"; switch (c) { case color::red: name = "red"; break;