From 74343496d7435a303d4aaed5a01a69918f5ea175 Mon Sep 17 00:00:00 2001 From: Yat Ho Date: Thu, 25 Jun 2026 01:01:32 +0800 Subject: [PATCH] fix: explicitly check `operator[]` in `is_contiguous` Prevent false positives when the container itself does not have `operator[](size_t)`, but the target type of one of the non-explicit user-defined conversion functions does. --- include/fmt/base.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index 5d0241c8..60d1b792 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -493,9 +493,10 @@ inline FMT_CONSTEXPR auto get_container(OutputIt it) -> template struct is_contiguous : std::false_type {}; template -struct is_contiguous().data()), - decltype(std::declval().size()), - decltype(std::declval()[size_t()])>> +struct is_contiguous().data()), + decltype(std::declval().size()), + decltype(std::declval().operator[](size_t()))>> : std::true_type {}; } // namespace detail