From 7536fe6a4df300d7062ccd427171e1466b82c6dd Mon Sep 17 00:00:00 2001 From: Shawn Zhong Date: Tue, 17 Jan 2023 22:11:22 -0600 Subject: [PATCH] Attempt to fix windows build --- include/fmt/ranges.h | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index fcd83e3d..5ec80d72 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -671,36 +671,29 @@ template class is_container_adaptor_like { static constexpr const bool value = !std::is_void(nullptr))>::value; }; - -template -auto get_container(T& t) -> - typename std::add_const::type& { - struct getter : T { - static auto get(const T& t) -> - typename std::add_const::type& { - return t.*(&getter::c); // Access c through the derived class. - } - }; - return getter::get(t); -} - } // namespace detail template struct formatter::value>> { - struct formatter())), Char> - container_formatter; + private: + struct formatter container_formatter; + public: template FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) { return container_formatter.parse(ctx); } template - auto format(const T& value, FormatContext& ctx) const -> + auto format(const T& t, FormatContext& ctx) const -> typename FormatContext::iterator { - return container_formatter.format(detail::get_container(value), ctx); + struct getter : T { + static auto get(const T& t) -> decltype(t.*(&getter::c)) { + return t.*(&getter::c); // Access c through the derived class. + } + }; + return container_formatter.format(getter::get(t), ctx); } };