Skip to content

Commit

Permalink
Fix formatting of ranges of code unit types
Browse files Browse the repository at this point in the history
Thanks Nicole Mazzuca.
  • Loading branch information
vitaut committed Aug 26, 2022
1 parent 3a3b070 commit 4a8e294
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/fmt/ranges.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ template <typename Range>
using uncvref_type = remove_cvref_t<range_reference_type<Range>>;

template <typename Range>
using uncvref_first_type = remove_cvref_t<
decltype(std::declval<range_reference_type<Range>>().first)>;
using uncvref_first_type =
remove_cvref_t<decltype(std::declval<range_reference_type<Range>>().first)>;

template <typename Range>
using uncvref_second_type = remove_cvref_t<
Expand Down Expand Up @@ -377,7 +377,7 @@ template <typename T, typename Char> struct is_range {
static constexpr const bool value =
detail::is_range_<T>::value && !detail::is_std_string_like<T>::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 {
Expand Down
4 changes: 4 additions & 0 deletions test/ranges-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,7 @@ TEST(ranges_test, range_of_range_of_mixed_const) {
fmt_ref_view<decltype(v)> r{&v};
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']");
}

0 comments on commit 4a8e294

Please sign in to comment.