diff --git a/test/ranges-test.cc b/test/ranges-test.cc index f2ab3c9f..7df723f7 100644 --- a/test/ranges-test.cc +++ b/test/ranges-test.cc @@ -803,38 +803,36 @@ struct not_range { static_assert(!fmt::is_formattable{}, ""); namespace test_detail { -template struct partial_opt_out_wrapper { - using container_type = std::vector; - std::vector c = {1, 2, 3}; + template + struct partial_opt_out_wrapper { + using container_type = std::vector; + std::vector c = {1, 2, 3}; - typename std::vector::const_iterator begin() const { return c.begin(); } - typename std::vector::const_iterator end() const { return c.end(); } -}; + typename std::vector::const_iterator begin() const { return c.begin(); } + typename std::vector::const_iterator end() const { return c.end(); } + }; } // namespace test_detail namespace fmt { -template -struct is_range, char> - : std::false_type {}; + template + struct is_range, char> : std::false_type {}; -template -struct is_container_adaptor> - : std::false_type {}; + template + struct is_container_adaptor> : std::false_type {}; + + template + struct formatter> { + constexpr fmt::format_parse_context::iterator parse(fmt::format_parse_context& ctx) const { + return ctx.begin(); + } + + fmt::format_context::iterator format(const test_detail::partial_opt_out_wrapper& val, + fmt::format_context& ctx) const { + return fmt::format_to(ctx.out(), "PartialOptOut(size={})", val.c.size()); + } + }; } // namespace fmt -template -struct fmt::formatter> { - fmt::format_parse_context::iterator parse(fmt::format_parse_context& ctx) - { - return ctx.begin(); - } - - fmt::format_context::iterator format(const test_detail::partial_opt_out_wrapper& val, - fmt::format_context& ctx) const { - return fmt::format_to(ctx.out(), "PartialOptOut(size={})", val.c.size()); - } -}; - TEST(ranges_test, container_adaptor_partial_specialization) { test_detail::partial_opt_out_wrapper obj; EXPECT_EQ(fmt::format("{}", obj), "PartialOptOut(size=3)");