diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index c8ab9143..8e24aba2 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -675,25 +675,16 @@ template class is_container_adaptor_like { template struct formatter::value>> { - private: - struct formatter container_formatter; - - public: - template - FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) { - return container_formatter.parse(ctx); - } - + enable_if_t::value>> + : formatter { template - auto format(T& t, FormatContext& ctx) const -> - typename FormatContext::iterator { + auto format(T& t, FormatContext& ctx) const -> decltype(ctx.out()) { struct getter : T { static auto get(T& t) -> typename T::container_type& { return t.*(&getter::c); // Access c through the derived class. } }; - return container_formatter.format(getter::get(t), ctx); + return formatter::format(getter::get(t), ctx); } };