From Jason Turner

[format.parse.ctx]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpv026qn17/{from.md → to.md} +100 -0
tmp/tmpv026qn17/{from.md → to.md} RENAMED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class template `basic_format_parse_context` <a id="format.parse.ctx">[[format.parse.ctx]]</a>
2
+
3
+ ``` cpp
4
+ namespace std {
5
+ template<class charT>
6
+ class basic_format_parse_context {
7
+ public:
8
+ using char_type = charT;
9
+ using const_iterator = typename basic_string_view<charT>::const_iterator;
10
+ using iterator = const_iterator;
11
+
12
+ private:
13
+ iterator begin_; // exposition only
14
+ iterator end_; // exposition only
15
+ enum indexing { unknown, manual, automatic }; // 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,
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 the
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 `num_args`.
48
+
49
+ ``` cpp
50
+ constexpr const_iterator begin() const noexcept;
51
+ ```
52
+
53
+ *Returns:* `begin_`.
54
+
55
+ ``` cpp
56
+ constexpr const_iterator end() const noexcept;
57
+ ```
58
+
59
+ *Returns:* `end_`.
60
+
61
+ ``` cpp
62
+ constexpr void advance_to(const_iterator it);
63
+ ```
64
+
65
+ *Preconditions:* `end()` is reachable from `it`.
66
+
67
+ *Effects:* Equivalent to: `begin_ = it;`
68
+
69
+ ``` cpp
70
+ constexpr size_t next_arg_id();
71
+ ```
72
+
73
+ *Effects:* If `indexing_ != manual`, equivalent to:
74
+
75
+ ``` cpp
76
+ if (indexing_ == unknown)
77
+ indexing_ = automatic;
78
+ return next_arg_id_++;
79
+ ```
80
+
81
+ *Throws:* `format_error` if `indexing_ == manual` which indicates mixing
82
+ of automatic and manual argument indexing.
83
+
84
+ ``` cpp
85
+ constexpr void check_arg_id(size_t id);
86
+ ```
87
+
88
+ *Effects:* If `indexing_ != automatic`, equivalent to:
89
+
90
+ ``` cpp
91
+ if (indexing_ == unknown)
92
+ indexing_ = manual;
93
+ ```
94
+
95
+ *Throws:* `format_error` if `indexing_ == automatic` which indicates
96
+ mixing of automatic and manual argument indexing.
97
+
98
+ *Remarks:* Call expressions where `id >= num_args_` are not core
99
+ constant expressions [[expr.const]].
100
+