2.3 KiB
[format.range.fmtstr]
28 Text processing library [text]
28.5 Formatting [format]
28.5.7 Formatting of ranges [format.range]
28.5.7.6 Specialization of range-default-formatter for strings [format.range.fmtstr]
namespace std {template<range_format K, ranges::input_range R, class charT>requires (K == range_format::string || K == range_format::debug_string)struct range-default-formatter<K, R, charT> {private: formatter<basic_string, charT> underlying_; // exposition onlypublic:templateconstexpr typename ParseContext::iterator parse(ParseContext& ctx); templatetypename FormatContext::iterator format(see below& str, FormatContext& ctx) const; };}
Mandates: same_as<remove_cvref_t<range_reference_t>, charT> is true.
template<class ParseContext> constexpr typename ParseContext::iterator parse(ParseContext& ctx);
Effects: Equivalent to:auto i = underlying_.parse(ctx);if constexpr (K == range_format::debug_string) {underlying_.set_debug_format();}return i;
template<class FormatContext> typename FormatContext::iterator format(see below& r, FormatContext& ctx) const;
The type of r is const R& if ranges::input_range is true andR& otherwise.
Effects: Let s be a basic_string such thatranges::equal(s, r) is true.
Equivalent to: return underlying_.format(s, ctx);