From Jason Turner

[istreambuf.iterator.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpfjv43r98/{from.md → to.md} +60 -0
tmp/tmpfjv43r98/{from.md → to.md} RENAMED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### General <a id="istreambuf.iterator.general">[[istreambuf.iterator.general]]</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
+
21
+ ``` cpp
22
+ namespace std {
23
+ template<class charT, class traits = char_traits<charT>>
24
+ class istreambuf_iterator {
25
+ public:
26
+ using iterator_category = input_iterator_tag;
27
+ using value_type = charT;
28
+ using difference_type = typename traits::off_type;
29
+ using pointer = unspecified;
30
+ using reference = charT;
31
+ using char_type = charT;
32
+ using traits_type = traits;
33
+ using int_type = typename traits::int_type;
34
+ using streambuf_type = basic_streambuf<charT,traits>;
35
+ using istream_type = basic_istream<charT,traits>;
36
+
37
+ // [istreambuf.iterator.proxy], class istreambuf_iterator::proxy
38
+ class proxy; // exposition only
39
+
40
+ constexpr istreambuf_iterator() noexcept;
41
+ constexpr istreambuf_iterator(default_sentinel_t) noexcept;
42
+ istreambuf_iterator(const istreambuf_iterator&) noexcept = default;
43
+ ~istreambuf_iterator() = default;
44
+ istreambuf_iterator(istream_type& s) noexcept;
45
+ istreambuf_iterator(streambuf_type* s) noexcept;
46
+ istreambuf_iterator(const proxy& p) noexcept;
47
+ istreambuf_iterator& operator=(const istreambuf_iterator&) noexcept = default;
48
+ charT operator*() const;
49
+ istreambuf_iterator& operator++();
50
+ proxy operator++(int);
51
+ bool equal(const istreambuf_iterator& b) const;
52
+
53
+ friend bool operator==(const istreambuf_iterator& i, default_sentinel_t s);
54
+
55
+ private:
56
+ streambuf_type* sbuf_; // exposition only
57
+ };
58
+ }
59
+ ```
60
+