Repository: fmtlib/fmt
File: include/fmt/ranges.h (C/C++)

Code before:
                  std::declval<Element>()))>,
              Char>,
    fallback_formatter<Element, Char>>;

template <typename R>
using maybe_const_range =
    conditional_t<has_const_begin_end<R>::value, const R, R>;

}  // namespace detail

template <typename T, typename Char, typename Enable = void>
struct range_formatter;

template <typename T, typename Char>
struct range_formatter<
    T, Char,
    enable_if_t<conjunction<
        std::is_same<T, remove_cvref_t<T>>,
        disjunction<is_formattable<T, Char>,
                    detail::has_fallback_formatter<T, Char>>>::value>> {
 private:
  detail::range_formatter_type<Char, T> underlying_;
  bool custom_specs_ = false;
  basic_string_view<Char> separator_ = FMT_STATICALLY_WIDEN(Char, ", ");
  basic_string_view<Char> opening_bracket_ = FMT_STATICALLY_WIDEN(Char, "[");
  basic_string_view<Char> closing_bracket_ = FMT_STATICALLY_WIDEN(Char, "]");

  template <class U>
  FMT_CONSTEXPR static auto maybe_set_debug_format(U& u, int)
      -> decltype(u.set_debug_format()) {
    u.set_debug_format();
  }

  template <class U>
  FMT_CONSTEXPR static void maybe_set_debug_format(U&, long) {}

  FMT_CONSTEXPR void maybe_set_debug_format() {
    maybe_set_debug_format(underlying_, 0);
  }

 public:
  FMT_CONSTEXPR range_formatter() { }

  FMT_CONSTEXPR auto underlying() -> detail::range_formatter_type<Char, T>& {
    return underlying_;
  }

  FMT_CONSTEXPR void set_separator(basic_string_view<Char> sep) {
    separator_ = sep;
  }


Review comment (suggestion):
Let's do what was suggested in https://github.com/fmtlib/fmt/pull/2983#issuecomment-1181291453 and remove `FMT_STATICALLY_WIDEN`.

Code after:
              Char>,
    fallback_formatter<Element, Char>>;

template <typename R>
using maybe_const_range =
    conditional_t<has_const_begin_end<R>::value, const R, R>;

}  // namespace detail

template <typename T, typename Char, typename Enable = void>
struct range_formatter;

template <typename T, typename Char>
struct range_formatter<
    T, Char,
    enable_if_t<conjunction<
        std::is_same<T, remove_cvref_t<T>>,
        disjunction<is_formattable<T, Char>,
                    detail::has_fallback_formatter<T, Char>>>::value>> {
 private:
  detail::range_formatter_type<Char, T> underlying_;
  bool custom_specs_ = false;
  basic_string_view<Char> separator_ = detail::string_literal<Char, ',', ' '>{};
  basic_string_view<Char> opening_bracket_ =
      detail::string_literal<Char, '['>{};
  basic_string_view<Char> closing_bracket_ =
      detail::string_literal<Char, ']'>{};

  template <class U>
  FMT_CONSTEXPR static auto maybe_set_debug_format(U& u, int)
      -> decltype(u.set_debug_format()) {
    u.set_debug_format();
  }

  template <class U>
  FMT_CONSTEXPR static void maybe_set_debug_format(U&, ...) {}

  FMT_CONSTEXPR void maybe_set_debug_format() {
    maybe_set_debug_format(underlying_, 0);
  }

 public:
  FMT_CONSTEXPR range_formatter() {}

  FMT_CONSTEXPR auto underlying() -> detail::range_formatter_type<Char, T>& {
    return underlying_;
  }

  FMT_CONSTEXPR void set_separator(basic_string_view<Char> sep) {
    separator_ = sep;
  }