From Jason Turner

[diff.cpp20.utilities]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3vp2km3o/{from.md → to.md} +53 -0
tmp/tmp3vp2km3o/{from.md → to.md} RENAMED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### [[utilities]]: general utilities library <a id="diff.cpp20.utilities">[[diff.cpp20.utilities]]</a>
2
+
3
+ **Change:** Signature changes: `format`, `format_to`, `vformat_to`,
4
+ `format_to_n`, `formatted_size`. Removal of `format_args_t`.
5
+ **Rationale:** Improve safety via compile-time format string checks,
6
+ avoid unnecessary template instantiations. **Effect on original
7
+ feature:** Valid C++20 code that contained errors in format strings or
8
+ relied on previous format string signatures or `format_args_t` may
9
+ become ill-formed. For example:
10
+
11
+ ``` cpp
12
+ auto s = std::format("{:d}", "I am not a number"); // ill-formed,
13
+ // previously threw format_error
14
+ ```
15
+
16
+ **Change:** Signature changes: `format`, `format_to`, `format_to_n`,
17
+ `formatted_size`. **Rationale:** Enable formatting of views that do not
18
+ support iteration when const-qualified and that are not copyable.
19
+ **Effect on original feature:** Valid C++20 code that passes bit fields
20
+ to formatting functions may become ill-formed. For example:
21
+
22
+ ``` cpp
23
+ struct tiny {
24
+ int bit: 1;
25
+ };
26
+
27
+ auto t = tiny();
28
+ std::format("{}", t.bit); // ill-formed, previously returned "0"
29
+ ```
30
+
31
+ **Change:** Restrict types of formatting arguments used as *width* or
32
+ *precision* in a *std-format-spec*. **Rationale:** Disallow types that
33
+ do not have useful or portable semantics as a formatting width or
34
+ precision. **Effect on original feature:** Valid C++20 code that passes
35
+ a boolean or character type as *arg-id* becomes invalid. For example:
36
+
37
+ ``` cpp
38
+ std::format("{:*^{}}", "", true); // ill-formed, previously returned "*"
39
+ std::format("{:*^{}}", "", '1'); // ill-formed, previously returned an
40
+ // implementation-defined number of '*' characters
41
+ ```
42
+
43
+ **Change:** Removed the `formatter` specialization:
44
+
45
+ ``` cpp
46
+ template<size_t N> struct formatter<const charT[N], charT>;
47
+ ```
48
+
49
+ **Rationale:** The specialization is inconsistent with the design of
50
+ `formatter`, which is intended to be instantiated only with
51
+ cv-unqualified object types. **Effect on original feature:** Valid C++20
52
+ code that instantiated the removed specialization can become ill-formed.
53
+