tmp/tmpco55a0ic/{from.md → to.md}
RENAMED
|
@@ -4,11 +4,11 @@
|
|
| 4 |
namespace std {
|
| 5 |
template<class charT>
|
| 6 |
class basic_format_parse_context {
|
| 7 |
public:
|
| 8 |
using char_type = charT;
|
| 9 |
-
using const_iterator =
|
| 10 |
using iterator = const_iterator;
|
| 11 |
|
| 12 |
private:
|
| 13 |
iterator begin_; // exposition only
|
| 14 |
iterator end_; // exposition only
|
|
@@ -16,37 +16,49 @@ namespace std {
|
|
| 16 |
indexing indexing_; // exposition only
|
| 17 |
size_t next_arg_id_; // exposition only
|
| 18 |
size_t num_args_; // exposition only
|
| 19 |
|
| 20 |
public:
|
| 21 |
-
constexpr explicit basic_format_parse_context(basic_string_view<charT> fmt
|
| 22 |
-
size_t num_args = 0) noexcept;
|
| 23 |
basic_format_parse_context(const basic_format_parse_context&) = delete;
|
| 24 |
basic_format_parse_context& operator=(const basic_format_parse_context&) = delete;
|
| 25 |
|
| 26 |
constexpr const_iterator begin() const noexcept;
|
| 27 |
constexpr const_iterator end() const noexcept;
|
| 28 |
constexpr void advance_to(const_iterator it);
|
| 29 |
|
| 30 |
constexpr size_t next_arg_id();
|
| 31 |
constexpr void check_arg_id(size_t id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
};
|
| 33 |
}
|
| 34 |
```
|
| 35 |
|
| 36 |
An instance of `basic_format_parse_context` holds the format string
|
| 37 |
-
parsing state consisting of the format string range being parsed and
|
| 38 |
-
argument counter for automatic indexing.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
``` cpp
|
| 41 |
-
constexpr explicit basic_format_parse_context(basic_string_view<charT> fmt
|
| 42 |
-
size_t num_args = 0) noexcept;
|
| 43 |
```
|
| 44 |
|
| 45 |
*Effects:* Initializes `begin_` with `fmt.begin()`, `end_` with
|
| 46 |
`fmt.end()`, `indexing_` with `unknown`, `next_arg_id_` with `0`, and
|
| 47 |
-
`num_args_` with `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
constexpr const_iterator begin() const noexcept;
|
| 51 |
```
|
| 52 |
|
|
@@ -76,12 +88,14 @@ constexpr size_t next_arg_id();
|
|
| 76 |
if (indexing_ == unknown)
|
| 77 |
indexing_ = automatic;
|
| 78 |
return next_arg_id_++;
|
| 79 |
```
|
| 80 |
|
| 81 |
-
*Throws:* `format_error` if `indexing_ == manual` is `true`
|
| 82 |
-
|
|
|
|
|
|
|
| 83 |
|
| 84 |
*Remarks:* Let *`cur-arg-id`* be the value of `next_arg_id_` prior to
|
| 85 |
this call. Call expressions where *`cur-arg-id`*` >= num_args_` is
|
| 86 |
`true` are not core constant expressions [[expr.const]].
|
| 87 |
|
|
@@ -94,11 +108,50 @@ constexpr void check_arg_id(size_t id);
|
|
| 94 |
``` cpp
|
| 95 |
if (indexing_ == unknown)
|
| 96 |
indexing_ = manual;
|
| 97 |
```
|
| 98 |
|
| 99 |
-
*Throws:* `format_error` if `indexing_ == automatic` is `true`
|
| 100 |
-
indicates mixing of automatic and manual argument indexing.
|
| 101 |
|
| 102 |
-
*
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
|
|
|
| 4 |
namespace std {
|
| 5 |
template<class charT>
|
| 6 |
class basic_format_parse_context {
|
| 7 |
public:
|
| 8 |
using char_type = charT;
|
| 9 |
+
using const_iterator = basic_string_view<charT>::const_iterator;
|
| 10 |
using iterator = const_iterator;
|
| 11 |
|
| 12 |
private:
|
| 13 |
iterator begin_; // exposition only
|
| 14 |
iterator end_; // exposition only
|
|
|
|
| 16 |
indexing indexing_; // exposition only
|
| 17 |
size_t next_arg_id_; // exposition only
|
| 18 |
size_t num_args_; // exposition only
|
| 19 |
|
| 20 |
public:
|
| 21 |
+
constexpr explicit basic_format_parse_context(basic_string_view<charT> fmt) noexcept;
|
|
|
|
| 22 |
basic_format_parse_context(const basic_format_parse_context&) = delete;
|
| 23 |
basic_format_parse_context& operator=(const basic_format_parse_context&) = delete;
|
| 24 |
|
| 25 |
constexpr const_iterator begin() const noexcept;
|
| 26 |
constexpr const_iterator end() const noexcept;
|
| 27 |
constexpr void advance_to(const_iterator it);
|
| 28 |
|
| 29 |
constexpr size_t next_arg_id();
|
| 30 |
constexpr void check_arg_id(size_t id);
|
| 31 |
+
|
| 32 |
+
template<class... Ts>
|
| 33 |
+
constexpr void check_dynamic_spec(size_t id) noexcept;
|
| 34 |
+
constexpr void check_dynamic_spec_integral(size_t id) noexcept;
|
| 35 |
+
constexpr void check_dynamic_spec_string(size_t id) noexcept;
|
| 36 |
};
|
| 37 |
}
|
| 38 |
```
|
| 39 |
|
| 40 |
An instance of `basic_format_parse_context` holds the format string
|
| 41 |
+
parsing state, consisting of the format string range being parsed and
|
| 42 |
+
the argument counter for automatic indexing.
|
| 43 |
+
|
| 44 |
+
If a program declares an explicit or partial specialization of
|
| 45 |
+
`basic_format_parse_context`, the program is ill-formed, no diagnostic
|
| 46 |
+
required.
|
| 47 |
|
| 48 |
``` cpp
|
| 49 |
+
constexpr explicit basic_format_parse_context(basic_string_view<charT> fmt) noexcept;
|
|
|
|
| 50 |
```
|
| 51 |
|
| 52 |
*Effects:* Initializes `begin_` with `fmt.begin()`, `end_` with
|
| 53 |
`fmt.end()`, `indexing_` with `unknown`, `next_arg_id_` with `0`, and
|
| 54 |
+
`num_args_` with `0`.
|
| 55 |
+
|
| 56 |
+
[*Note 1*: Any call to `next_arg_id`, `check_arg_id`, or
|
| 57 |
+
`check_dynamic_spec` on an instance of `basic_format_parse_context`
|
| 58 |
+
initialized using this constructor is not a core constant
|
| 59 |
+
expression. — *end note*]
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
constexpr const_iterator begin() const noexcept;
|
| 63 |
```
|
| 64 |
|
|
|
|
| 88 |
if (indexing_ == unknown)
|
| 89 |
indexing_ = automatic;
|
| 90 |
return next_arg_id_++;
|
| 91 |
```
|
| 92 |
|
| 93 |
+
*Throws:* `format_error` if `indexing_ == manual` is `true`.
|
| 94 |
+
|
| 95 |
+
[*Note 2*: This indicates mixing of automatic and manual argument
|
| 96 |
+
indexing. — *end note*]
|
| 97 |
|
| 98 |
*Remarks:* Let *`cur-arg-id`* be the value of `next_arg_id_` prior to
|
| 99 |
this call. Call expressions where *`cur-arg-id`*` >= num_args_` is
|
| 100 |
`true` are not core constant expressions [[expr.const]].
|
| 101 |
|
|
|
|
| 108 |
``` cpp
|
| 109 |
if (indexing_ == unknown)
|
| 110 |
indexing_ = manual;
|
| 111 |
```
|
| 112 |
|
| 113 |
+
*Throws:* `format_error` if `indexing_ == automatic` is `true`.
|
|
|
|
| 114 |
|
| 115 |
+
[*Note 3*: This indicates mixing of automatic and manual argument
|
| 116 |
+
indexing. — *end note*]
|
| 117 |
+
|
| 118 |
+
*Remarks:* A call to this function is a core constant
|
| 119 |
+
expression [[expr.const]] only if `id < num_args_` is `true`.
|
| 120 |
+
|
| 121 |
+
``` cpp
|
| 122 |
+
template<class... Ts>
|
| 123 |
+
constexpr void check_dynamic_spec(size_t id) noexcept;
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
*Mandates:* `sizeof...(Ts)` ≥ 1. The types in `Ts...` are unique. Each
|
| 127 |
+
type in `Ts...` is one of `bool`, `char_type`, `int`, `unsigned int`,
|
| 128 |
+
`long long int`, `unsigned long long int`, `float`, `double`,
|
| 129 |
+
`long double`, `const char_type*`, `basic_string_view<char_type>`, or
|
| 130 |
+
`const void*`.
|
| 131 |
+
|
| 132 |
+
*Remarks:* A call to this function is a core constant expression only if
|
| 133 |
+
|
| 134 |
+
- `id < num_args_` is `true` and
|
| 135 |
+
- the type of the corresponding format argument (after conversion to
|
| 136 |
+
`basic_format_arg<Context>`) is one of the types in `Ts...`.
|
| 137 |
+
|
| 138 |
+
``` cpp
|
| 139 |
+
constexpr void check_dynamic_spec_integral(size_t id) noexcept;
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
*Effects:* Equivalent to:
|
| 143 |
+
|
| 144 |
+
``` cpp
|
| 145 |
+
check_dynamic_spec<int, unsigned int, long long int, unsigned long long int>(id);
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
``` cpp
|
| 149 |
+
constexpr void check_dynamic_spec_string(size_t id) noexcept;
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
*Effects:* Equivalent to:
|
| 153 |
+
|
| 154 |
+
``` cpp
|
| 155 |
+
check_dynamic_spec<const char_type*, basic_string_view<char_type>>(id);
|
| 156 |
+
```
|
| 157 |
|