@@ -515,7 +515,8 @@ struct formatter<
515
515
enable_if_t <conjunction<
516
516
bool_constant<range_format_kind<R, Char>::value !=
517
517
range_format::disabled &&
518
- range_format_kind<R, Char>::value != range_format::map>
518
+ range_format_kind<R, Char>::value != range_format::map &&
519
+ range_format_kind<R, Char>::value != range_format::string>
519
520
// Workaround a bug in MSVC 2015 and earlier.
520
521
#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910
521
522
,
@@ -604,6 +605,30 @@ struct formatter<
604
605
}
605
606
};
606
607
608
+ // A string formatter.
609
+ template <typename R, typename Char>
610
+ struct formatter <
611
+ R, Char,
612
+ enable_if_t <range_format_kind<R, Char>::value == range_format::string>> {
613
+ private:
614
+ using range_type = detail::maybe_const_range<R>;
615
+ formatter<std::basic_string_view<Char>, Char> range_formatter_;
616
+
617
+ public:
618
+ FMT_CONSTEXPR formatter () {}
619
+
620
+ template <typename ParseContext>
621
+ FMT_CONSTEXPR auto parse (ParseContext& ctx) -> decltype(ctx.begin()) {
622
+ return range_formatter_.parse (ctx);
623
+ }
624
+
625
+ template <typename FormatContext>
626
+ auto format (range_type& range, FormatContext& ctx) const
627
+ -> decltype(ctx.out()) {
628
+ return range_formatter_.format (std::basic_string_view<Char>(range), ctx);
629
+ }
630
+ };
631
+
607
632
template <typename It, typename Sentinel, typename Char = char >
608
633
struct join_view : detail::view {
609
634
It begin;
0 commit comments