From 864d6125549c86b894ce21125f7a9f1f39bdd680 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Thu, 14 Dec 2023 23:45:32 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20C++11=20-=20Properly=20hide=20de?= =?UTF-8?q?duced=20return=20type=20from=20view?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/fmt/core.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 771a1c00..a850c1c6 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1833,6 +1833,15 @@ decltype(auto) get_appendable_buffer(Output&& out) { return get_buffer(std::forward(out)); } } + +template +FMT_INLINE auto get_iterator(Buf& buf, Output&&) -> decltype(buf.out()) { + return buf.out(); +} +template +auto get_iterator(buffer&, Output&& out) { + return out; +} #else template auto get_buffer(OutputIt out) -> iterator_buffer { @@ -1843,16 +1852,16 @@ template out) -> buffer& { return get_container(out); } -#endif -template -FMT_INLINE auto get_iterator(Buf& buf, Output&&) -> decltype(buf.out()) { +template +FMT_INLINE auto get_iterator(Buf& buf, OutputIt) -> decltype(buf.out()) { return buf.out(); } -template -auto get_iterator(buffer&, Output&& out) { +template +auto get_iterator(buffer&, OutputIt out) -> OutputIt { return out; } +#endif // A type-erased reference to an std::locale to avoid a heavy include. class locale_ref {