diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index d6c2eb11..9459c038 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -260,27 +260,35 @@ OutputIt add_range_formatting_spaces(OutputIt out, return out; } -template +template < + typename Char, typename OutputIt, typename Arg, + FMT_ENABLE_IF(std::is_same::value || + is_like_std_string::type>::value)> OutputIt write_range_entry(OutputIt out, const Arg& v) { - FMT_CONSTEXPR_DECL const char quote = []() { - if (const_check( - std::is_same::value || - is_like_std_string::type>::value)) { - return '"'; - } else if (const_check(std::is_same::value)) { - return '\''; - } else { - return '\0'; - } - }(); - - if (const_check(quote)) *out++ = quote; + *out++ = '"'; out = write(out, v); - if (const_check(quote)) *out++ = quote; - + *out++ = '"'; return out; } +template ::value)> +OutputIt write_range_entry(OutputIt out, const Arg v) { + *out++ = '\''; + *out++ = v; + *out++ = '\''; + return out; +} + +template < + typename Char, typename OutputIt, typename Arg, + FMT_ENABLE_IF(!std::is_same::value && + !is_like_std_string::type>::value && + !std::is_same::value)> +OutputIt write_range_entry(OutputIt out, const Arg& v) { + return write(out, v); +} + } // namespace detail template struct is_tuple_like {