From Jason Turner

[istreambuf.iterator]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_1wxxap_/{from.md → to.md} +35 -37
tmp/tmp_1wxxap_/{from.md → to.md} RENAMED
@@ -1,19 +1,20 @@
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
 
@@ -34,64 +35,63 @@ namespace std {
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
  };
51
-
52
- template <class charT, class traits>
53
- bool operator==(const istreambuf_iterator<charT,traits>& a,
54
- const istreambuf_iterator<charT,traits>& b);
55
- template <class charT, class traits>
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
67
- charT keep_;
68
- basic_streambuf<charT,traits>* sbuf_;
69
- proxy(charT c, basic_streambuf<charT,traits>* sbuf)
70
- : keep_(c), sbuf_(sbuf) { }
71
- public:
72
- charT operator*() { return keep_; }
73
- };
74
- }
75
- ```
76
 
77
  Class `istreambuf_iterator<charT,traits>::proxy` is for exposition only.
78
  An implementation is permitted to provide equivalent functionality
79
  without providing a class with this name. Class
80
  `istreambuf_iterator<charT, traits>::proxy` provides a temporary
81
  placeholder as the return value of the post-increment operator
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
@@ -110,14 +110,14 @@ istreambuf_iterator(streambuf_type* s) noexcept;
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
 
@@ -131,11 +131,11 @@ istreambuf_iterator& operator++();
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
 
@@ -150,12 +150,10 @@ template <class charT, class traits>
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
  ```
159
 
160
- *Returns:* `!a.equal(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(nullptr)` both construct an
12
+ end-of-stream iterator object suitable for use as an end-of-range. All
13
+ specializations of `istreambuf_iterator` shall have a trivial copy
14
+ constructor, a `constexpr` default constructor, and a trivial
15
+ 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
 
 
35
  using istream_type = basic_istream<charT,traits>;
36
 
37
  class proxy; // exposition only
38
 
39
  constexpr istreambuf_iterator() noexcept;
40
+ constexpr istreambuf_iterator(default_sentinel_t) noexcept;
41
  istreambuf_iterator(const istreambuf_iterator&) noexcept = default;
42
  ~istreambuf_iterator() = default;
43
  istreambuf_iterator(istream_type& s) noexcept;
44
  istreambuf_iterator(streambuf_type* s) noexcept;
45
  istreambuf_iterator(const proxy& p) noexcept;
46
+ istreambuf_iterator& operator=(const istreambuf_iterator&) noexcept = default;
47
  charT operator*() const;
48
  istreambuf_iterator& operator++();
49
  proxy operator++(int);
50
  bool equal(const istreambuf_iterator& b) const;
51
+
52
+ friend bool operator==(const istreambuf_iterator& i, default_sentinel_t s);
53
+
54
  private:
55
  streambuf_type* sbuf_; // exposition only
56
  };
 
 
 
 
 
 
 
57
  }
58
  ```
59
 
60
+ #### Class `istreambuf_iterator::proxy` <a id="istreambuf.iterator.proxy">[[istreambuf.iterator.proxy]]</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  Class `istreambuf_iterator<charT,traits>::proxy` is for exposition only.
63
  An implementation is permitted to provide equivalent functionality
64
  without providing a class with this name. Class
65
  `istreambuf_iterator<charT, traits>::proxy` provides a temporary
66
  placeholder as the return value of the post-increment operator
67
  (`operator++`). It keeps the character pointed to by the previous value
68
  of the iterator for some possible future access to get the character.
69
 
70
+ ``` cpp
71
+ namespace std {
72
+ template<class charT, class traits>
73
+ class istreambuf_iterator<charT, traits>::proxy { // exposition only
74
+ charT keep_;
75
+ basic_streambuf<charT,traits>* sbuf_;
76
+ proxy(charT c, basic_streambuf<charT,traits>* sbuf)
77
+ : keep_(c), sbuf_(sbuf) { }
78
+ public:
79
+ charT operator*() { return keep_; }
80
+ };
81
+ }
82
+ ```
83
 
84
+ #### Constructors <a id="istreambuf.iterator.cons">[[istreambuf.iterator.cons]]</a>
85
+
86
+ For each `istreambuf_iterator` constructor in this subclause, an
87
  end-of-stream iterator is constructed if and only if the exposition-only
88
  member `sbuf_` is initialized with a null pointer value.
89
 
90
  ``` cpp
91
  constexpr istreambuf_iterator() noexcept;
92
+ constexpr istreambuf_iterator(default_sentinel_t) noexcept;
93
  ```
94
 
95
  *Effects:* Initializes `sbuf_` with `nullptr`.
96
 
97
  ``` cpp
 
110
  istreambuf_iterator(const proxy& p) noexcept;
111
  ```
112
 
113
  *Effects:* Initializes `sbuf_` with `p.sbuf_`.
114
 
115
+ #### 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
 
 
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
 
 
150
  ```
151
 
152
  *Returns:* `a.equal(b)`.
153
 
154
  ``` cpp
155
+ friend bool operator==(const istreambuf_iterator& i, default_sentinel_t s);
 
 
156
  ```
157
 
158
+ *Returns:* `i.equal(s)`.
159