From c03288b0a7ee49b4753c8e45b090df916d9b75a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kr=C3=BCgler?= Date: Sun, 10 Jul 2022 09:16:17 +0200 Subject: [PATCH] - Rename is_not_recursive_range to is_nonrecursive_range and add comment that explains it being depending on is_range being true - Merge has_fallback_formatter_delayed into is_formattable_delayed and add comment that explains it being depending on is_not_recursive_range being true - Replace disjunction in formatter specialization by has_fallback_formatter_delayed - Get rid of unneeded detail:: prefixes within namespace detail --- include/fmt/ranges.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 280d1c57..8b7c9aad 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -391,19 +391,21 @@ template using maybe_const_range = conditional_t::value, const R, R>; +// is_nonrecursive_range depends on fmt::is_range::value == true. +// It exists to ensure short-circuit evaluation in the constraint of the +// formatter specialization below. A similar approach is used in +// https://wg21.link/p2286. template -struct is_not_recursive_range : bool_constant< - !std::is_same, R>::value> {}; +struct is_nonrecursive_range : bool_constant< + !std::is_same, R>::value> {}; +// is_formattable_delayed depends on is_nonrecursive_range::value == true. +// It exists to ensure short-circuit evaluation in the constraint of the +// formatter specialization below. template -struct is_formattable_delayed : is_formattable< - detail::uncvref_type>, Char> { -}; - -template -struct has_fallback_formatter_delayed : detail::has_fallback_formatter< - detail::uncvref_type>, Char> { -}; +struct is_formattable_delayed : disjunction< + is_formattable>, Char>, + has_fallback_formatter>, Char>> {}; } // namespace detail @@ -412,14 +414,11 @@ struct formatter< R, Char, enable_if_t< conjunction, - detail::is_not_recursive_range + detail::is_nonrecursive_range // Workaround a bug in MSVC 2015 and earlier. #if !FMT_MSC_VERSION || FMT_MSC_VERSION > 1900 , - disjunction< - detail::is_formattable_delayed, - detail::has_fallback_formatter_delayed - > + detail::is_formattable_delayed #endif >::value >> {