From b8f911fba715cb6ee7eca51df62dfa12cc29152f Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Sun, 31 Mar 2019 12:47:37 -0400 Subject: [PATCH] Fix a couple of deprecated things. --- doc/api.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/api.rst b/doc/api.rst index c6665daa..cf4fe88a 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -111,11 +111,13 @@ template and implement ``parse`` and ``format`` methods:: template <> struct formatter { template - constexpr auto parse(ParseContext &ctx) { return ctx.begin(); } + constexpr auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { + return ctx.begin(); + } template - auto format(const point &p, FormatContext &ctx) { - return format_to(ctx.begin(), "({:.1f}, {:.1f})", p.x, p.y); + auto format(const point &p, FormatContext &ctx) -> decltype(ctx.out()) { + return format_to(ctx.out(), "({:.1f}, {:.1f})", p.x, p.y); } }; } @@ -129,7 +131,7 @@ Then you can pass objects of type ``point`` to any formatting function:: In the example above the ``formatter::parse`` function ignores the contents of the format string referred to by ``ctx.begin()`` so the object will always be formatted in the same way. See ``formatter::parse`` in -:file:`fmt/time.h` for an advanced example of how to parse the format string and +:file:`fmt/chrono.h` for an advanced example of how to parse the format string and customize the formatted output. You can also reuse existing formatters, for example::