Fix formatting of ranges of code unit types

Thanks Nicole Mazzuca.
This commit is contained in:
Victor Zverovich 2022-08-25 17:28:22 -07:00
parent 3a3b0709e2
commit 4a8e2949bb
2 changed files with 7 additions and 3 deletions

View File

@ -270,8 +270,8 @@ template <typename Range>
using uncvref_type = remove_cvref_t<range_reference_type<Range>>; using uncvref_type = remove_cvref_t<range_reference_type<Range>>;
template <typename Range> template <typename Range>
using uncvref_first_type = remove_cvref_t< using uncvref_first_type =
decltype(std::declval<range_reference_type<Range>>().first)>; remove_cvref_t<decltype(std::declval<range_reference_type<Range>>().first)>;
template <typename Range> template <typename Range>
using uncvref_second_type = remove_cvref_t< using uncvref_second_type = remove_cvref_t<
@ -377,7 +377,7 @@ template <typename T, typename Char> struct is_range {
static constexpr const bool value = static constexpr const bool value =
detail::is_range_<T>::value && !detail::is_std_string_like<T>::value && detail::is_range_<T>::value && !detail::is_std_string_like<T>::value &&
!std::is_convertible<T, std::basic_string<Char>>::value && !std::is_convertible<T, std::basic_string<Char>>::value &&
!std::is_constructible<detail::std_string_view<Char>, T>::value; !std::is_convertible<T, detail::std_string_view<Char>>::value;
}; };
namespace detail { namespace detail {

View File

@ -418,3 +418,7 @@ TEST(ranges_test, range_of_range_of_mixed_const) {
fmt_ref_view<decltype(v)> r{&v}; fmt_ref_view<decltype(v)> r{&v};
EXPECT_EQ(fmt::format("{}", r), "[[1, 2, 3], [4, 5]]"); EXPECT_EQ(fmt::format("{}", r), "[[1, 2, 3], [4, 5]]");
} }
TEST(ranges_test, vector_char) {
EXPECT_EQ(fmt::format("{}", std::vector<char>{'a', 'b'}), "['a', 'b']");
}