Files
2025-10-25 03:02:53 +03:00

2.3 KiB
Raw Permalink Blame History

[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; };}

1

#

Mandates: same_as<remove_cvref_t<range_reference_t>, charT> is true.

🔗

template<class ParseContext> constexpr typename ParseContext::iterator parse(ParseContext& ctx);

2

#

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;

3

#

The type of r is const R& if ranges::input_range is true andR& otherwise.

4

#

Effects: Let s be a basic_string such thatranges::equal(s, r) is true.

Equivalent to: return underlying_.format(s, ctx);