56 lines
2.3 KiB
Markdown
56 lines
2.3 KiB
Markdown
[format.range.fmtstr]
|
||
|
||
# 28 Text processing library [[text]](./#text)
|
||
|
||
## 28.5 Formatting [[format]](format#range.fmtstr)
|
||
|
||
### 28.5.7 Formatting of ranges [[format.range]](format.range#fmtstr)
|
||
|
||
#### 28.5.7.6 Specialization of *range-default-formatter* for strings [format.range.fmtstr]
|
||
|
||
[ð](#lib:range-default-formatter)
|
||
|
||
namespace std {template<range_format K, ranges::[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") 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>, charT> *underlying_*; // *exposition only*public:template<class ParseContext>constexpr typename ParseContext::iterator
|
||
parse(ParseContext& ctx); template<class FormatContext>typename FormatContext::iterator
|
||
format(*see below*& str, FormatContext& ctx) const; };}
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L8373)
|
||
|
||
*Mandates*: [same_as](concept.same#concept:same_as "18.4.2 Concept same_as [concept.same]")<remove_cvref_t<range_reference_t<R>>, charT> is true[.](#1.sentence-1)
|
||
|
||
[ð](#lib:parse,range-default-formatter)
|
||
|
||
`template<class ParseContext>
|
||
constexpr typename ParseContext::iterator
|
||
parse(ParseContext& ctx);
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L8386)
|
||
|
||
*Effects*: Equivalent to:auto i = *underlying_*.parse(ctx);if constexpr (K == range_format::debug_string) {*underlying_*.set_debug_format();}return i;
|
||
|
||
[ð](#lib:format,range-default-formatter)
|
||
|
||
`template<class FormatContext>
|
||
typename FormatContext::iterator
|
||
format(see below& r, FormatContext& ctx) const;
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L8406)
|
||
|
||
The type of r is const R& if ranges::[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]")<const R> is true andR& otherwise[.](#3.sentence-1)
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L8411)
|
||
|
||
*Effects*: Let *s* be a basic_string<charT> such thatranges::equal(*s*, r) is true[.](#4.sentence-1)
|
||
|
||
Equivalent to: return *underlying_*.format(*s*, ctx);
|