From ecd6022c24e4fed94e1ea09029c386f36da4a2b8 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 8 Feb 2022 06:28:22 -0800 Subject: [PATCH] Update docs --- doc/api.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api.rst b/doc/api.rst index cd9eeb4a..46070ed6 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -227,7 +227,7 @@ template and implement ``parse`` and ``format`` methods:: // Formats the point p using the parsed format specification (presentation) // stored in this formatter. template - auto format(const point& p, FormatContext& ctx) -> decltype(ctx.out()) { + auto format(const point& p, FormatContext& ctx) const -> decltype(ctx.out()) { // ctx.out() is an output iterator to write to. return presentation == 'f' ? format_to(ctx.out(), "({:.1f}, {:.1f})", p.x, p.y) @@ -249,7 +249,7 @@ example:: template <> struct fmt::formatter: formatter { // parse is inherited from formatter. template - auto format(color c, FormatContext& ctx) { + auto format(color c, FormatContext& ctx) const { string_view name = "unknown"; switch (c) { case color::red: name = "red"; break; @@ -287,7 +287,7 @@ You can also write a formatter for a hierarchy of classes:: struct fmt::formatter::value, char>> : fmt::formatter { template - auto format(const A& a, FormatCtx& ctx) { + auto format(const A& a, FormatCtx& ctx) const { return fmt::formatter::format(a.name(), ctx); } };