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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Formatting of ranges <a id="format.range">[[format.range]]</a>
|
| 2 |
+
|
| 3 |
+
#### Variable template `format_kind` <a id="format.range.fmtkind">[[format.range.fmtkind]]</a>
|
| 4 |
+
|
| 5 |
+
``` cpp
|
| 6 |
+
template<ranges::input_range R>
|
| 7 |
+
requires same_as<R, remove_cvref_t<R>>
|
| 8 |
+
constexpr range_format format_kind<R> = see below;
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
A program that instantiates the primary template of `format_kind` is
|
| 12 |
+
ill-formed.
|
| 13 |
+
|
| 14 |
+
For a type `R`, `format_kind<R>` is defined as follows:
|
| 15 |
+
|
| 16 |
+
- If `same_as<remove_cvref_t<ranges::range_reference_t<R>>, R>` is
|
| 17 |
+
`true`, `format_kind<R>` is `range_format::disabled`. \[*Note 1*: This
|
| 18 |
+
prevents constraint recursion for ranges whose reference type is the
|
| 19 |
+
same range type. For example, `std::filesystem::path` is a range of
|
| 20 |
+
`std::filesystem::path`. — *end note*]
|
| 21 |
+
- Otherwise, if the *qualified-id* `R::key_type` is valid and denotes a
|
| 22 |
+
type:
|
| 23 |
+
- If the *qualified-id* `R::mapped_type` is valid and denotes a type,
|
| 24 |
+
let `U` be `remove_cvref_t<ranges::range_reference_t<R>>`. If either
|
| 25 |
+
`U` is a specialization of `pair` or `U` is a specialization of
|
| 26 |
+
`tuple` and `tuple_size_v<U> == 2`, `format_kind<R>` is
|
| 27 |
+
`range_format::map`.
|
| 28 |
+
- Otherwise, `format_kind<R>` is `range_format::set`.
|
| 29 |
+
- Otherwise, `format_kind<R>` is `range_format::sequence`.
|
| 30 |
+
|
| 31 |
+
*Remarks:* Pursuant to [[namespace.std]], users may specialize
|
| 32 |
+
`format_kind` for cv-unqualified program-defined types that model
|
| 33 |
+
`ranges::input_range`. Such specializations shall be usable in constant
|
| 34 |
+
expressions [[expr.const]] and have type `const range_format`.
|
| 35 |
+
|
| 36 |
+
#### Class template `range_formatter` <a id="format.range.formatter">[[format.range.formatter]]</a>
|
| 37 |
+
|
| 38 |
+
``` cpp
|
| 39 |
+
namespace std {
|
| 40 |
+
template<class T, class charT = char>
|
| 41 |
+
requires same_as<remove_cvref_t<T>, T> && formattable<T, charT>
|
| 42 |
+
class range_formatter {
|
| 43 |
+
formatter<T, charT> underlying_; // exposition only
|
| 44 |
+
basic_string_view<charT> separator_ = STATICALLY-WIDEN<charT>(", "); // exposition only
|
| 45 |
+
basic_string_view<charT> opening-bracket_ = STATICALLY-WIDEN<charT>("["); // exposition only
|
| 46 |
+
basic_string_view<charT> closing-bracket_ = STATICALLY-WIDEN<charT>("]"); // exposition only
|
| 47 |
+
|
| 48 |
+
public:
|
| 49 |
+
constexpr void set_separator(basic_string_view<charT> sep) noexcept;
|
| 50 |
+
constexpr void set_brackets(basic_string_view<charT> opening,
|
| 51 |
+
basic_string_view<charT> closing) noexcept;
|
| 52 |
+
constexpr formatter<T, charT>& underlying() noexcept { return underlying_; }
|
| 53 |
+
constexpr const formatter<T, charT>& underlying() const noexcept { return underlying_; }
|
| 54 |
+
|
| 55 |
+
template<class ParseContext>
|
| 56 |
+
constexpr typename ParseContext::iterator
|
| 57 |
+
parse(ParseContext& ctx);
|
| 58 |
+
|
| 59 |
+
template<ranges::input_range R, class FormatContext>
|
| 60 |
+
requires formattable<ranges::range_reference_t<R>, charT> &&
|
| 61 |
+
same_as<remove_cvref_t<ranges::range_reference_t<R>>, T>
|
| 62 |
+
typename FormatContext::iterator
|
| 63 |
+
format(R&& r, FormatContext& ctx) const;
|
| 64 |
+
};
|
| 65 |
+
}
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
The class template `range_formatter` is a utility for implementing
|
| 69 |
+
`formatter` specializations for range types.
|
| 70 |
+
|
| 71 |
+
`range_formatter` interprets *format-spec* as a *range-format-spec*. The
|
| 72 |
+
syntax of format specifications is as follows:
|
| 73 |
+
|
| 74 |
+
``` bnf
|
| 75 |
+
range-format-spec
|
| 76 |
+
range-fill-and-alignₒₚₜ widthₒₚₜ 'n'ₒₚₜ range-typeₒₚₜ range-underlying-specₒₚₜ
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
``` bnf
|
| 80 |
+
range-fill-and-align
|
| 81 |
+
range-fillₒₚₜ align
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
``` bnf
|
| 85 |
+
range-fill
|
| 86 |
+
any character other than '{' or '}' or ':'
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
``` bnf
|
| 90 |
+
range-type
|
| 91 |
+
'm'
|
| 92 |
+
's'
|
| 93 |
+
'?s'
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
``` bnf
|
| 97 |
+
range-underlying-spec
|
| 98 |
+
':' format-spec
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
For `range_formatter<T, charT>`, the *format-spec* in a
|
| 102 |
+
*range-underlying-spec*, if any, is interpreted by
|
| 103 |
+
`formatter<T, charT>`.
|
| 104 |
+
|
| 105 |
+
The *range-fill-and-align* is interpreted the same way as a
|
| 106 |
+
*fill-and-align* [[format.string.std]]. The productions *align* and
|
| 107 |
+
*width* are described in [[format.string]].
|
| 108 |
+
|
| 109 |
+
The `n` option causes the range to be formatted without the opening and
|
| 110 |
+
closing brackets.
|
| 111 |
+
|
| 112 |
+
[*Note 1*: This is equivalent to invoking
|
| 113 |
+
`set_brackets({}, {})`. — *end note*]
|
| 114 |
+
|
| 115 |
+
The *range-type* specifier changes the way a range is formatted, with
|
| 116 |
+
certain options only valid with certain argument types. The meaning of
|
| 117 |
+
the various type options is as specified in [[formatter.range.type]].
|
| 118 |
+
|
| 119 |
+
**Table: Meaning of range-type options** <a id="formatter.range.type">[formatter.range.type]</a>
|
| 120 |
+
|
| 121 |
+
| Option | Requirements | Meaning |
|
| 122 |
+
| ------ | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 123 |
+
| % `m` | `T` shall be either a specialization of `pair` or a specialization of `tuple` such that `tuple_size_v<T>` is `2`. | Indicates that the opening bracket should be `"{"`, the closing bracket should be `"}"`, the separator should be `", "`, and each range element should be formatted as if `m` were specified for its tuple-type. *If the `n` option is provided in addition to the `m` option, both the opening and closing brackets are still empty.* |
|
| 124 |
+
| % `s` | `T` shall be `charT`. | Indicates that the range should be formatted as a `string`. |
|
| 125 |
+
| % `?s` | `T` shall be `charT`. | Indicates that the range should be formatted as an escaped string [[format.string.escaped]]. |
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
If the *range-type* is `s` or `?s`, then there shall be no `n` option
|
| 129 |
+
and no *range-underlying-spec*.
|
| 130 |
+
|
| 131 |
+
``` cpp
|
| 132 |
+
constexpr void set_separator(basic_string_view<charT> sep) noexcept;
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
*Effects:* Equivalent to: *`separator_`*` = sep;`
|
| 136 |
+
|
| 137 |
+
``` cpp
|
| 138 |
+
constexpr void set_brackets(basic_string_view<charT> opening,
|
| 139 |
+
basic_string_view<charT> closing) noexcept;
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
*Effects:* Equivalent to:
|
| 143 |
+
|
| 144 |
+
``` cpp
|
| 145 |
+
opening-bracket_ = opening;
|
| 146 |
+
closing-bracket_ = closing;
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
``` cpp
|
| 150 |
+
template<class ParseContext>
|
| 151 |
+
constexpr typename ParseContext::iterator
|
| 152 |
+
parse(ParseContext& ctx);
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
*Effects:* Parses the format specifier as a *range-format-spec* and
|
| 156 |
+
stores the parsed specifiers in `*this`. The values of
|
| 157 |
+
*opening-bracket\_*, *closing-bracket\_*, and *separator\_* are modified
|
| 158 |
+
if and only if required by the *range-type* or the `n` option, if
|
| 159 |
+
present. If:
|
| 160 |
+
|
| 161 |
+
- the *range-type* is neither `s` nor `?s`,
|
| 162 |
+
- *`underlying_`*`.set_debug_format()` is a valid expression, and
|
| 163 |
+
- there is no *range-underlying-spec*,
|
| 164 |
+
|
| 165 |
+
then calls *`underlying_`*`.set_debug_format()`.
|
| 166 |
+
|
| 167 |
+
*Returns:* An iterator past the end of the *range-format-spec*.
|
| 168 |
+
|
| 169 |
+
``` cpp
|
| 170 |
+
template<ranges::input_range R, class FormatContext>
|
| 171 |
+
requires formattable<ranges::range_reference_t<R>, charT> &&
|
| 172 |
+
same_as<remove_cvref_t<ranges::range_reference_t<R>>, T>
|
| 173 |
+
typename FormatContext::iterator
|
| 174 |
+
format(R&& r, FormatContext& ctx) const;
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
*Effects:* Writes the following into `ctx.out()`, adjusted according to
|
| 178 |
+
the *range-format-spec*:
|
| 179 |
+
|
| 180 |
+
- If the *range-type* was `s`, then as if by formatting
|
| 181 |
+
`basic_string<charT>(from_range, r)`.
|
| 182 |
+
- Otherwise, if the *range-type* was `?s`, then as if by formatting
|
| 183 |
+
`basic_string<charT>(from_range, r)` as an escaped
|
| 184 |
+
string [[format.string.escaped]].
|
| 185 |
+
- Otherwise,
|
| 186 |
+
- *opening-bracket\_*,
|
| 187 |
+
- for each element `e` of the range `r`:
|
| 188 |
+
- the result of writing `e` via *underlying\_* and
|
| 189 |
+
- *separator\_*, unless `e` is the last element of `r`, and
|
| 190 |
+
- *closing-bracket\_*.
|
| 191 |
+
|
| 192 |
+
*Returns:* An iterator past the end of the output range.
|
| 193 |
+
|
| 194 |
+
#### Class template *`range-default-formatter`* <a id="format.range.fmtdef">[[format.range.fmtdef]]</a>
|
| 195 |
+
|
| 196 |
+
``` cpp
|
| 197 |
+
namespace std {
|
| 198 |
+
template<ranges::input_range R, class charT>
|
| 199 |
+
struct range-default-formatter<range_format::sequence, R, charT> { // exposition only
|
| 200 |
+
private:
|
| 201 |
+
using maybe-const-r = fmt-maybe-const<R, charT>; // exposition only
|
| 202 |
+
range_formatter<remove_cvref_t<ranges::range_reference_t<maybe-const-r>>,
|
| 203 |
+
charT> underlying_; // exposition only
|
| 204 |
+
|
| 205 |
+
public:
|
| 206 |
+
constexpr void set_separator(basic_string_view<charT> sep) noexcept;
|
| 207 |
+
constexpr void set_brackets(basic_string_view<charT> opening,
|
| 208 |
+
basic_string_view<charT> closing) noexcept;
|
| 209 |
+
|
| 210 |
+
template<class ParseContext>
|
| 211 |
+
constexpr typename ParseContext::iterator
|
| 212 |
+
parse(ParseContext& ctx);
|
| 213 |
+
|
| 214 |
+
template<class FormatContext>
|
| 215 |
+
typename FormatContext::iterator
|
| 216 |
+
format(maybe-const-r& elems, FormatContext& ctx) const;
|
| 217 |
+
};
|
| 218 |
+
}
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
``` cpp
|
| 222 |
+
constexpr void set_separator(basic_string_view<charT> sep) noexcept;
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
*Effects:* Equivalent to: *`underlying_`*`.set_separator(sep);`
|
| 226 |
+
|
| 227 |
+
``` cpp
|
| 228 |
+
constexpr void set_brackets(basic_string_view<charT> opening,
|
| 229 |
+
basic_string_view<charT> closing) noexcept;
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
*Effects:* Equivalent to:
|
| 233 |
+
*`underlying_`*`.set_brackets(opening, closing);`
|
| 234 |
+
|
| 235 |
+
``` cpp
|
| 236 |
+
template<class ParseContext>
|
| 237 |
+
constexpr typename ParseContext::iterator
|
| 238 |
+
parse(ParseContext& ctx);
|
| 239 |
+
```
|
| 240 |
+
|
| 241 |
+
*Effects:* Equivalent to: `return `*`underlying_`*`.parse(ctx);`
|
| 242 |
+
|
| 243 |
+
``` cpp
|
| 244 |
+
template<class FormatContext>
|
| 245 |
+
typename FormatContext::iterator
|
| 246 |
+
format(maybe-const-r& elems, FormatContext& ctx) const;
|
| 247 |
+
```
|
| 248 |
+
|
| 249 |
+
*Effects:* Equivalent to: `return `*`underlying_`*`.format(elems, ctx);`
|
| 250 |
+
|
| 251 |
+
#### Specialization of *`range-default-formatter`* for maps <a id="format.range.fmtmap">[[format.range.fmtmap]]</a>
|
| 252 |
+
|
| 253 |
+
``` cpp
|
| 254 |
+
namespace std {
|
| 255 |
+
template<ranges::input_range R, class charT>
|
| 256 |
+
struct range-default-formatter<range_format::map, R, charT> {
|
| 257 |
+
private:
|
| 258 |
+
using maybe-const-map = fmt-maybe-const<R, charT>; // exposition only
|
| 259 |
+
using element-type = // exposition only
|
| 260 |
+
remove_cvref_t<ranges::range_reference_t<maybe-const-map>>;
|
| 261 |
+
range_formatter<element-type, charT> underlying_; // exposition only
|
| 262 |
+
|
| 263 |
+
public:
|
| 264 |
+
constexpr range-default-formatter();
|
| 265 |
+
|
| 266 |
+
template<class ParseContext>
|
| 267 |
+
constexpr typename ParseContext::iterator
|
| 268 |
+
parse(ParseContext& ctx);
|
| 269 |
+
|
| 270 |
+
template<class FormatContext>
|
| 271 |
+
typename FormatContext::iterator
|
| 272 |
+
format(maybe-const-map& r, FormatContext& ctx) const;
|
| 273 |
+
};
|
| 274 |
+
}
|
| 275 |
+
```
|
| 276 |
+
|
| 277 |
+
``` cpp
|
| 278 |
+
constexpr range-default-formatter();
|
| 279 |
+
```
|
| 280 |
+
|
| 281 |
+
*Mandates:* Either:
|
| 282 |
+
|
| 283 |
+
- *element-type* is a specialization of `pair`, or
|
| 284 |
+
- *element-type* is a specialization of `tuple` and
|
| 285 |
+
`tuple_size_v<`*`element-type`*`> == 2`.
|
| 286 |
+
|
| 287 |
+
*Effects:* Equivalent to:
|
| 288 |
+
|
| 289 |
+
``` cpp
|
| 290 |
+
underlying_.set_brackets(STATICALLY-WIDEN<charT>("{"), STATICALLY-WIDEN<charT>("}"));
|
| 291 |
+
underlying_.underlying().set_brackets({}, {});
|
| 292 |
+
underlying_.underlying().set_separator(STATICALLY-WIDEN<charT>(": "));
|
| 293 |
+
```
|
| 294 |
+
|
| 295 |
+
``` cpp
|
| 296 |
+
template<class ParseContext>
|
| 297 |
+
constexpr typename ParseContext::iterator
|
| 298 |
+
parse(ParseContext& ctx);
|
| 299 |
+
```
|
| 300 |
+
|
| 301 |
+
*Effects:* Equivalent to: `return `*`underlying_`*`.parse(ctx);`
|
| 302 |
+
|
| 303 |
+
``` cpp
|
| 304 |
+
template<class FormatContext>
|
| 305 |
+
typename FormatContext::iterator
|
| 306 |
+
format(maybe-const-map& r, FormatContext& ctx) const;
|
| 307 |
+
```
|
| 308 |
+
|
| 309 |
+
*Effects:* Equivalent to: `return `*`underlying_`*`.format(r, ctx);`
|
| 310 |
+
|
| 311 |
+
#### Specialization of *`range-default-formatter`* for sets <a id="format.range.fmtset">[[format.range.fmtset]]</a>
|
| 312 |
+
|
| 313 |
+
``` cpp
|
| 314 |
+
namespace std {
|
| 315 |
+
template<ranges::input_range R, class charT>
|
| 316 |
+
struct range-default-formatter<range_format::set, R, charT> {
|
| 317 |
+
private:
|
| 318 |
+
using maybe-const-set = fmt-maybe-const<R, charT>; // exposition only
|
| 319 |
+
range_formatter<remove_cvref_t<ranges::range_reference_t<maybe-const-set>>,
|
| 320 |
+
charT> underlying_; // exposition only
|
| 321 |
+
|
| 322 |
+
public:
|
| 323 |
+
constexpr range-default-formatter();
|
| 324 |
+
|
| 325 |
+
template<class ParseContext>
|
| 326 |
+
constexpr typename ParseContext::iterator
|
| 327 |
+
parse(ParseContext& ctx);
|
| 328 |
+
|
| 329 |
+
template<class FormatContext>
|
| 330 |
+
typename FormatContext::iterator
|
| 331 |
+
format(maybe-const-set& r, FormatContext& ctx) const;
|
| 332 |
+
};
|
| 333 |
+
}
|
| 334 |
+
```
|
| 335 |
+
|
| 336 |
+
``` cpp
|
| 337 |
+
constexpr range-default-formatter();
|
| 338 |
+
```
|
| 339 |
+
|
| 340 |
+
*Effects:* Equivalent to:
|
| 341 |
+
|
| 342 |
+
``` cpp
|
| 343 |
+
underlying_.set_brackets(STATICALLY-WIDEN<charT>("{"), STATICALLY-WIDEN<charT>("}"));
|
| 344 |
+
```
|
| 345 |
+
|
| 346 |
+
``` cpp
|
| 347 |
+
template<class ParseContext>
|
| 348 |
+
constexpr typename ParseContext::iterator
|
| 349 |
+
parse(ParseContext& ctx);
|
| 350 |
+
```
|
| 351 |
+
|
| 352 |
+
*Effects:* Equivalent to: `return `*`underlying_`*`.parse(ctx);`
|
| 353 |
+
|
| 354 |
+
``` cpp
|
| 355 |
+
template<class FormatContext>
|
| 356 |
+
typename FormatContext::iterator
|
| 357 |
+
format(maybe-const-set& r, FormatContext& ctx) const;
|
| 358 |
+
```
|
| 359 |
+
|
| 360 |
+
*Effects:* Equivalent to: `return `*`underlying_`*`.format(r, ctx);`
|
| 361 |
+
|
| 362 |
+
#### Specialization of *`range-default-formatter`* for strings <a id="format.range.fmtstr">[[format.range.fmtstr]]</a>
|
| 363 |
+
|
| 364 |
+
``` cpp
|
| 365 |
+
namespace std {
|
| 366 |
+
template<range_format K, ranges::input_range R, class charT>
|
| 367 |
+
requires (K == range_format::string || K == range_format::debug_string)
|
| 368 |
+
struct range-default-formatter<K, R, charT> {
|
| 369 |
+
private:
|
| 370 |
+
formatter<basic_string<charT>, charT> underlying_; // exposition only
|
| 371 |
+
|
| 372 |
+
public:
|
| 373 |
+
template<class ParseContext>
|
| 374 |
+
constexpr typename ParseContext::iterator
|
| 375 |
+
parse(ParseContext& ctx);
|
| 376 |
+
|
| 377 |
+
template<class FormatContext>
|
| 378 |
+
typename FormatContext::iterator
|
| 379 |
+
format(see below& str, FormatContext& ctx) const;
|
| 380 |
+
};
|
| 381 |
+
}
|
| 382 |
+
```
|
| 383 |
+
|
| 384 |
+
*Mandates:* `same_as<remove_cvref_t<range_reference_t<R>>, charT>` is
|
| 385 |
+
`true`.
|
| 386 |
+
|
| 387 |
+
``` cpp
|
| 388 |
+
template<class ParseContext>
|
| 389 |
+
constexpr typename ParseContext::iterator
|
| 390 |
+
parse(ParseContext& ctx);
|
| 391 |
+
```
|
| 392 |
+
|
| 393 |
+
*Effects:* Equivalent to:
|
| 394 |
+
|
| 395 |
+
``` cpp
|
| 396 |
+
auto i = underlying_.parse(ctx);
|
| 397 |
+
if constexpr (K == range_format::debug_string) {
|
| 398 |
+
underlying_.set_debug_format();
|
| 399 |
+
}
|
| 400 |
+
return i;
|
| 401 |
+
```
|
| 402 |
+
|
| 403 |
+
``` cpp
|
| 404 |
+
template<class FormatContext>
|
| 405 |
+
typename FormatContext::iterator
|
| 406 |
+
format(see below& r, FormatContext& ctx) const;
|
| 407 |
+
```
|
| 408 |
+
|
| 409 |
+
The type of `r` is `const R&` if `ranges::input_range<const R>` is
|
| 410 |
+
`true` and `R&` otherwise.
|
| 411 |
+
|
| 412 |
+
*Effects:* Let *`s`* be a `basic_string<charT>` such that
|
| 413 |
+
`ranges::equal(`*`s`*`, r)` is `true`. Equivalent to:
|
| 414 |
+
`return `*`underlying_`*`.format(`*`s`*`, ctx);`
|
| 415 |
+
|