From Jason Turner

[istreambuf.iterator]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpl5_5eniy/{from.md → to.md} +40 -43
tmp/tmpl5_5eniy/{from.md → to.md} RENAMED
@@ -1,49 +1,50 @@
1
  ### Class template `istreambuf_iterator` <a id="istreambuf.iterator">[[istreambuf.iterator]]</a>
2
 
3
  The class template `istreambuf_iterator` defines an input iterator (
4
  [[input.iterators]]) that reads successive *characters* from the
5
  streambuf for which it was constructed. `operator*` provides access to
6
- the current input character, if any. `operator->` may return a proxy.
7
- Each time `operator++` is evaluated, the iterator advances to the next
8
- input character. If the end of stream is reached
9
- (`streambuf_type::sgetc()` returns `traits::eof()`), the iterator
10
- becomes equal to the *end-of-stream* iterator value. The default
11
- constructor `istreambuf_iterator()` and the constructor
12
- `istreambuf_iterator(0)` both construct an end-of-stream iterator object
13
- suitable for use as an end-of-range. All specializations of
14
- `istreambuf_iterator` shall have a trivial copy constructor, a
15
  `constexpr` default constructor, and a trivial destructor.
16
 
17
  The result of `operator*()` on an end-of-stream iterator is undefined.
18
  For any other iterator value a `char_type` value is returned. It is
19
  impossible to assign a character via an input iterator.
20
 
21
  ``` cpp
22
  namespace std {
23
  template<class charT, class traits = char_traits<charT>>
24
- class istreambuf_iterator
25
- : public iterator<input_iterator_tag, charT,
26
- typename traits::off_type, unspecified, charT> {
27
  public:
28
- typedef charT char_type;
29
- typedef traits traits_type;
30
- typedef typename traits::int_type int_type;
31
- typedef basic_streambuf<charT,traits> streambuf_type;
32
- typedef basic_istream<charT,traits> istream_type;
 
 
 
 
 
33
 
34
  class proxy; // exposition only
35
 
36
  constexpr istreambuf_iterator() noexcept;
37
  istreambuf_iterator(const istreambuf_iterator&) noexcept = default;
38
  ~istreambuf_iterator() = default;
39
  istreambuf_iterator(istream_type& s) noexcept;
40
  istreambuf_iterator(streambuf_type* s) noexcept;
41
  istreambuf_iterator(const proxy& p) noexcept;
42
  charT operator*() const;
43
- pointer operator->() const;
44
- istreambuf_iterator<charT,traits>& operator++();
45
  proxy operator++(int);
46
  bool equal(const istreambuf_iterator& b) const;
47
  private:
48
  streambuf_type* sbuf_; // exposition only
49
  };
@@ -55,11 +56,11 @@ namespace std {
55
  bool operator!=(const istreambuf_iterator<charT,traits>& a,
56
  const istreambuf_iterator<charT,traits>& b);
57
  }
58
  ```
59
 
60
- #### Class template `istreambuf_iterator::proxy` <a id="istreambuf.iterator::proxy">[[istreambuf.iterator::proxy]]</a>
61
 
62
  ``` cpp
63
  namespace std {
64
  template <class charT, class traits = char_traits<charT>>
65
  class istreambuf_iterator<charT, traits>::proxy { // exposition only
@@ -81,81 +82,77 @@ placeholder as the return value of the post-increment operator
81
  (`operator++`). It keeps the character pointed to by the previous value
82
  of the iterator for some possible future access to get the character.
83
 
84
  #### `istreambuf_iterator` constructors <a id="istreambuf.iterator.cons">[[istreambuf.iterator.cons]]</a>
85
 
 
 
 
 
86
  ``` cpp
87
  constexpr istreambuf_iterator() noexcept;
88
  ```
89
 
90
- *Effects:* Constructs the end-of-stream iterator.
91
 
92
  ``` cpp
93
- istreambuf_iterator(basic_istream<charT,traits>& s) noexcept;
94
- istreambuf_iterator(basic_streambuf<charT,traits>* s) noexcept;
95
  ```
96
 
97
- *Effects:* Constructs an `istreambuf_iterator<>` that uses the
98
- `basic_streambuf<>` object `*(s.rdbuf())`, or `*s`, respectively.
99
- Constructs an end-of-stream iterator if `s.rdbuf()` is null.
 
 
 
 
100
 
101
  ``` cpp
102
  istreambuf_iterator(const proxy& p) noexcept;
103
  ```
104
 
105
- *Effects:* Constructs a `istreambuf_iterator<>` that uses the
106
- `basic_streambuf<>` object pointed to by the `proxy` object’s
107
- constructor argument `p`.
108
 
109
- #### `istreambuf_iterator::operator*` <a id="istreambuf.iterator::op*">[[istreambuf.iterator::op*]]</a>
110
 
111
  ``` cpp
112
  charT operator*() const
113
  ```
114
 
115
  *Returns:* The character obtained via the `streambuf` member
116
  `sbuf_->sgetc()`.
117
 
118
- #### `istreambuf_iterator::operator++` <a id="istreambuf.iterator::op++">[[istreambuf.iterator::op++]]</a>
119
-
120
  ``` cpp
121
- istreambuf_iterator<charT,traits>&
122
- istreambuf_iterator<charT,traits>::operator++();
123
  ```
124
 
125
- *Effects:* `sbuf_->sbumpc()`.
126
 
127
  *Returns:* `*this`.
128
 
129
  ``` cpp
130
- proxy istreambuf_iterator<charT,traits>::operator++(int);
131
  ```
132
 
133
  *Returns:* `proxy(sbuf_->sbumpc(), sbuf_)`.
134
 
135
- #### `istreambuf_iterator::equal` <a id="istreambuf.iterator::equal">[[istreambuf.iterator::equal]]</a>
136
-
137
  ``` cpp
138
- bool equal(const istreambuf_iterator<charT,traits>& b) const;
139
  ```
140
 
141
  *Returns:* `true` if and only if both iterators are at end-of-stream, or
142
  neither is at end-of-stream, regardless of what `streambuf` object they
143
  use.
144
 
145
- #### `operator==` <a id="istreambuf.iterator::op==">[[istreambuf.iterator::op==]]</a>
146
-
147
  ``` cpp
148
  template <class charT, class traits>
149
  bool operator==(const istreambuf_iterator<charT,traits>& a,
150
  const istreambuf_iterator<charT,traits>& b);
151
  ```
152
 
153
  *Returns:* `a.equal(b)`.
154
 
155
- #### `operator!=` <a id="istreambuf.iterator::op!=">[[istreambuf.iterator::op!=]]</a>
156
-
157
  ``` cpp
158
  template <class charT, class traits>
159
  bool operator!=(const istreambuf_iterator<charT,traits>& a,
160
  const istreambuf_iterator<charT,traits>& b);
161
  ```
 
1
  ### Class template `istreambuf_iterator` <a id="istreambuf.iterator">[[istreambuf.iterator]]</a>
2
 
3
  The class template `istreambuf_iterator` defines an input iterator (
4
  [[input.iterators]]) that reads successive *characters* from the
5
  streambuf for which it was constructed. `operator*` provides access to
6
+ the current input character, if any. Each time `operator++` is
7
+ evaluated, the iterator advances to the next input character. If the end
8
+ of stream is reached (`streambuf_type::sgetc()` returns
9
+ `traits::eof()`), the iterator becomes equal to the *end-of-stream*
10
+ iterator value. The default constructor `istreambuf_iterator()` and the
11
+ constructor `istreambuf_iterator(0)` both construct an end-of-stream
12
+ iterator object suitable for use as an end-of-range. All specializations
13
+ of `istreambuf_iterator` shall have a trivial copy constructor, a
 
14
  `constexpr` default constructor, and a trivial destructor.
15
 
16
  The result of `operator*()` on an end-of-stream iterator is undefined.
17
  For any other iterator value a `char_type` value is returned. It is
18
  impossible to assign a character via an input iterator.
19
 
20
  ``` cpp
21
  namespace std {
22
  template<class charT, class traits = char_traits<charT>>
23
+ class istreambuf_iterator {
 
 
24
  public:
25
+ using iterator_category = input_iterator_tag;
26
+ using value_type = charT;
27
+ using difference_type = typename traits::off_type;
28
+ using pointer = unspecified;
29
+ using reference = charT;
30
+ using char_type = charT;
31
+ using traits_type = traits;
32
+ using int_type = typename traits::int_type;
33
+ using streambuf_type = basic_streambuf<charT,traits>;
34
+ using istream_type = basic_istream<charT,traits>;
35
 
36
  class proxy; // exposition only
37
 
38
  constexpr istreambuf_iterator() noexcept;
39
  istreambuf_iterator(const istreambuf_iterator&) noexcept = default;
40
  ~istreambuf_iterator() = default;
41
  istreambuf_iterator(istream_type& s) noexcept;
42
  istreambuf_iterator(streambuf_type* s) noexcept;
43
  istreambuf_iterator(const proxy& p) noexcept;
44
  charT operator*() const;
45
+ istreambuf_iterator& operator++();
 
46
  proxy operator++(int);
47
  bool equal(const istreambuf_iterator& b) const;
48
  private:
49
  streambuf_type* sbuf_; // exposition only
50
  };
 
56
  bool operator!=(const istreambuf_iterator<charT,traits>& a,
57
  const istreambuf_iterator<charT,traits>& b);
58
  }
59
  ```
60
 
61
+ #### Class template `istreambuf_iterator::proxy` <a id="istreambuf.iterator.proxy">[[istreambuf.iterator.proxy]]</a>
62
 
63
  ``` cpp
64
  namespace std {
65
  template <class charT, class traits = char_traits<charT>>
66
  class istreambuf_iterator<charT, traits>::proxy { // exposition only
 
82
  (`operator++`). It keeps the character pointed to by the previous value
83
  of the iterator for some possible future access to get the character.
84
 
85
  #### `istreambuf_iterator` constructors <a id="istreambuf.iterator.cons">[[istreambuf.iterator.cons]]</a>
86
 
87
+ For each `istreambuf_iterator` constructor in this section, an
88
+ end-of-stream iterator is constructed if and only if the exposition-only
89
+ member `sbuf_` is initialized with a null pointer value.
90
+
91
  ``` cpp
92
  constexpr istreambuf_iterator() noexcept;
93
  ```
94
 
95
+ *Effects:* Initializes `sbuf_` with `nullptr`.
96
 
97
  ``` cpp
98
+ istreambuf_iterator(istream_type& s) noexcept;
 
99
  ```
100
 
101
+ *Effects:* Initializes `sbuf_` with `s.rdbuf()`.
102
+
103
+ ``` cpp
104
+ istreambuf_iterator(streambuf_type* s) noexcept;
105
+ ```
106
+
107
+ *Effects:* Initializes `sbuf_` with `s`.
108
 
109
  ``` cpp
110
  istreambuf_iterator(const proxy& p) noexcept;
111
  ```
112
 
113
+ *Effects:* Initializes `sbuf_` with `p.sbuf_`.
 
 
114
 
115
+ #### `istreambuf_iterator` operations <a id="istreambuf.iterator.ops">[[istreambuf.iterator.ops]]</a>
116
 
117
  ``` cpp
118
  charT operator*() const
119
  ```
120
 
121
  *Returns:* The character obtained via the `streambuf` member
122
  `sbuf_->sgetc()`.
123
 
 
 
124
  ``` cpp
125
+ istreambuf_iterator& operator++();
 
126
  ```
127
 
128
+ *Effects:* As if by `sbuf_->sbumpc()`.
129
 
130
  *Returns:* `*this`.
131
 
132
  ``` cpp
133
+ proxy operator++(int);
134
  ```
135
 
136
  *Returns:* `proxy(sbuf_->sbumpc(), sbuf_)`.
137
 
 
 
138
  ``` cpp
139
+ bool equal(const istreambuf_iterator& b) const;
140
  ```
141
 
142
  *Returns:* `true` if and only if both iterators are at end-of-stream, or
143
  neither is at end-of-stream, regardless of what `streambuf` object they
144
  use.
145
 
 
 
146
  ``` cpp
147
  template <class charT, class traits>
148
  bool operator==(const istreambuf_iterator<charT,traits>& a,
149
  const istreambuf_iterator<charT,traits>& b);
150
  ```
151
 
152
  *Returns:* `a.equal(b)`.
153
 
 
 
154
  ``` cpp
155
  template <class charT, class traits>
156
  bool operator!=(const istreambuf_iterator<charT,traits>& a,
157
  const istreambuf_iterator<charT,traits>& b);
158
  ```