tmp/tmpvsa_72m6/{from.md → to.md}
RENAMED
|
@@ -4,44 +4,56 @@
|
|
| 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.
|
|
|
|
|
|
|
| 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
|
| 20 |
-
to formatting functions may become ill-formed.
|
|
|
|
|
|
|
| 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.
|
|
|
|
|
|
|
| 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 |
```
|
|
|
|
| 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.
|
| 10 |
+
|
| 11 |
+
[*Example 1*:
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
auto s = std::format("{:d}", "I am not a number"); // ill-formed,
|
| 15 |
// previously threw format_error
|
| 16 |
```
|
| 17 |
|
| 18 |
+
— *end example*]
|
| 19 |
+
|
| 20 |
**Change:** Signature changes: `format`, `format_to`, `format_to_n`,
|
| 21 |
`formatted_size`. **Rationale:** Enable formatting of views that do not
|
| 22 |
support iteration when const-qualified and that are not copyable.
|
| 23 |
+
**Effect on original feature:** Valid C++20 code that passes bit-fields
|
| 24 |
+
to formatting functions may become ill-formed.
|
| 25 |
+
|
| 26 |
+
[*Example 2*:
|
| 27 |
|
| 28 |
``` cpp
|
| 29 |
struct tiny {
|
| 30 |
int bit: 1;
|
| 31 |
};
|
| 32 |
|
| 33 |
auto t = tiny();
|
| 34 |
std::format("{}", t.bit); // ill-formed, previously returned "0"
|
| 35 |
```
|
| 36 |
|
| 37 |
+
— *end example*]
|
| 38 |
+
|
| 39 |
**Change:** Restrict types of formatting arguments used as *width* or
|
| 40 |
*precision* in a *std-format-spec*. **Rationale:** Disallow types that
|
| 41 |
do not have useful or portable semantics as a formatting width or
|
| 42 |
precision. **Effect on original feature:** Valid C++20 code that passes
|
| 43 |
+
a boolean or character type as *arg-id* becomes invalid.
|
| 44 |
+
|
| 45 |
+
[*Example 3*:
|
| 46 |
|
| 47 |
``` cpp
|
| 48 |
std::format("{:*^{}}", "", true); // ill-formed, previously returned "*"
|
| 49 |
std::format("{:*^{}}", "", '1'); // ill-formed, previously returned an
|
| 50 |
// implementation-defined number of '*' characters
|
| 51 |
```
|
| 52 |
|
| 53 |
+
— *end example*]
|
| 54 |
+
|
| 55 |
**Change:** Removed the `formatter` specialization:
|
| 56 |
|
| 57 |
``` cpp
|
| 58 |
template<size_t N> struct formatter<const charT[N], charT>;
|
| 59 |
```
|