From Jason Turner

[ifstream]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp8q90_p7t/{from.md → to.md} +25 -15
tmp/tmp8q90_p7t/{from.md → to.md} RENAMED
@@ -6,14 +6,15 @@
6
  namespace std {
7
  template<class charT, class traits = char_traits<charT>>
8
  class basic_ifstream : public basic_istream<charT, traits> {
9
  public:
10
  using char_type = charT;
11
- using int_type = typename traits::int_type;
12
- using pos_type = typename traits::pos_type;
13
- using off_type = typename traits::off_type;
14
  using traits_type = traits;
 
15
 
16
  // [ifstream.cons], constructors
17
  basic_ifstream();
18
  explicit basic_ifstream(const char* s,
19
  ios_base::openmode mode = ios_base::in);
@@ -32,10 +33,11 @@ namespace std {
32
  // [ifstream.swap], swap
33
  void swap(basic_ifstream& rhs);
34
 
35
  // [ifstream.members], members
36
  basic_filebuf<charT, traits>* rdbuf() const;
 
37
 
38
  bool is_open() const;
39
  void open(const char* s, ios_base::openmode mode = ios_base::in);
40
  void open(const filesystem::path::value_type* s,
41
  ios_base::openmode mode = ios_base::in); // wide systems only; see [fstream.syn]
@@ -52,83 +54,91 @@ namespace std {
52
  The class `basic_ifstream<charT, traits>` supports reading from named
53
  files. It uses a `basic_filebuf<{}charT, traits>` object to control the
54
  associated sequence. For the sake of exposition, the maintained data is
55
  presented here as:
56
 
57
- - `sb`, the `filebuf` object.
58
 
59
  #### Constructors <a id="ifstream.cons">[[ifstream.cons]]</a>
60
 
61
  ``` cpp
62
  basic_ifstream();
63
  ```
64
 
65
  *Effects:* Initializes the base class with
66
- `basic_istream<charT, traits>(addressof(sb))` [[istream.cons]] and `sb`
67
- with `basic_filebuf<charT, traits>()` [[filebuf.cons]].
68
 
69
  ``` cpp
70
  explicit basic_ifstream(const char* s,
71
  ios_base::openmode mode = ios_base::in);
72
  explicit basic_ifstream(const filesystem::path::value_type* s,
73
  ios_base::openmode mode = ios_base::in); // wide systems only; see [fstream.syn]
74
  ```
75
 
76
  *Effects:* Initializes the base class with
77
- `basic_istream<charT, traits>(addressof(sb))` [[istream.cons]] and `sb`
78
- with `basic_filebuf<charT, traits>()` [[filebuf.cons]], then calls
79
  `rdbuf()->open(s, mode | ios_base::in)`. If that function returns a null
80
  pointer, calls `setstate(failbit)`.
81
 
82
  ``` cpp
83
  explicit basic_ifstream(const string& s,
84
  ios_base::openmode mode = ios_base::in);
85
  ```
86
 
87
- *Effects:* Equivalent to: `basic_ifstream(s.c_str(), mode)`.
88
 
89
  ``` cpp
90
  template<class T>
91
  explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
92
  ```
93
 
94
  *Constraints:* `is_same_v<T, filesystem::path>` is `true`.
95
 
96
- *Effects:* Equivalent to: `basic_ifstream(s.c_str(), mode)`.
97
 
98
  ``` cpp
99
  basic_ifstream(basic_ifstream&& rhs);
100
  ```
101
 
102
  *Effects:* Move constructs the base class, and the contained
103
  `basic_filebuf`. Then calls
104
- `basic_istream<charT, traits>::set_rdbuf(addressof(sb))` to install the
105
- contained `basic_filebuf`.
106
 
107
  #### Swap <a id="ifstream.swap">[[ifstream.swap]]</a>
108
 
109
  ``` cpp
110
  void swap(basic_ifstream& rhs);
111
  ```
112
 
113
  *Effects:* Exchanges the state of `*this` and `rhs` by calling
114
- `basic_istream<charT, traits>::swap(rhs)` and `sb.swap(rhs.sb)`.
 
115
 
116
  ``` cpp
117
  template<class charT, class traits>
118
  void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
119
  ```
120
 
121
- *Effects:* Equivalent to: `x.swap(y)`.
122
 
123
  #### Member functions <a id="ifstream.members">[[ifstream.members]]</a>
124
 
125
  ``` cpp
126
  basic_filebuf<charT, traits>* rdbuf() const;
127
  ```
128
 
129
- *Returns:* `const_cast<basic_filebuf<charT, traits>*>(addressof(sb))`.
 
 
 
 
 
 
 
130
 
131
  ``` cpp
132
  bool is_open() const;
133
  ```
134
 
 
6
  namespace std {
7
  template<class charT, class traits = char_traits<charT>>
8
  class basic_ifstream : public basic_istream<charT, traits> {
9
  public:
10
  using char_type = charT;
11
+ using int_type = traits::int_type;
12
+ using pos_type = traits::pos_type;
13
+ using off_type = traits::off_type;
14
  using traits_type = traits;
15
+ using native_handle_type = basic_filebuf<charT, traits>::native_handle_type;
16
 
17
  // [ifstream.cons], constructors
18
  basic_ifstream();
19
  explicit basic_ifstream(const char* s,
20
  ios_base::openmode mode = ios_base::in);
 
33
  // [ifstream.swap], swap
34
  void swap(basic_ifstream& rhs);
35
 
36
  // [ifstream.members], members
37
  basic_filebuf<charT, traits>* rdbuf() const;
38
+ native_handle_type native_handle() const noexcept;
39
 
40
  bool is_open() const;
41
  void open(const char* s, ios_base::openmode mode = ios_base::in);
42
  void open(const filesystem::path::value_type* s,
43
  ios_base::openmode mode = ios_base::in); // wide systems only; see [fstream.syn]
 
54
  The class `basic_ifstream<charT, traits>` supports reading from named
55
  files. It uses a `basic_filebuf<{}charT, traits>` object to control the
56
  associated sequence. For the sake of exposition, the maintained data is
57
  presented here as:
58
 
59
+ - *`sb`*, the `filebuf` object.
60
 
61
  #### Constructors <a id="ifstream.cons">[[ifstream.cons]]</a>
62
 
63
  ``` cpp
64
  basic_ifstream();
65
  ```
66
 
67
  *Effects:* Initializes the base class with
68
+ `basic_istream<charT, traits>(addressof(`*`sb`*`))` [[istream.cons]] and
69
+ *sb* with `basic_filebuf<charT, traits>()` [[filebuf.cons]].
70
 
71
  ``` cpp
72
  explicit basic_ifstream(const char* s,
73
  ios_base::openmode mode = ios_base::in);
74
  explicit basic_ifstream(const filesystem::path::value_type* s,
75
  ios_base::openmode mode = ios_base::in); // wide systems only; see [fstream.syn]
76
  ```
77
 
78
  *Effects:* Initializes the base class with
79
+ `basic_istream<charT, traits>(addressof(`*`sb`*`))` [[istream.cons]] and
80
+ *sb* with `basic_filebuf<charT, traits>()` [[filebuf.cons]], then calls
81
  `rdbuf()->open(s, mode | ios_base::in)`. If that function returns a null
82
  pointer, calls `setstate(failbit)`.
83
 
84
  ``` cpp
85
  explicit basic_ifstream(const string& s,
86
  ios_base::openmode mode = ios_base::in);
87
  ```
88
 
89
+ *Effects:* Equivalent to `basic_ifstream(s.c_str(), mode)`.
90
 
91
  ``` cpp
92
  template<class T>
93
  explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
94
  ```
95
 
96
  *Constraints:* `is_same_v<T, filesystem::path>` is `true`.
97
 
98
+ *Effects:* Equivalent to `basic_ifstream(s.c_str(), mode)`.
99
 
100
  ``` cpp
101
  basic_ifstream(basic_ifstream&& rhs);
102
  ```
103
 
104
  *Effects:* Move constructs the base class, and the contained
105
  `basic_filebuf`. Then calls
106
+ `basic_istream<charT, traits>::set_rdbuf(addressof(`*`sb`*`))` to
107
+ install the contained `basic_filebuf`.
108
 
109
  #### Swap <a id="ifstream.swap">[[ifstream.swap]]</a>
110
 
111
  ``` cpp
112
  void swap(basic_ifstream& rhs);
113
  ```
114
 
115
  *Effects:* Exchanges the state of `*this` and `rhs` by calling
116
+ `basic_istream<charT, traits>::swap(rhs)` and
117
+ *`sb`*`.swap(rhs.`*`sb`*`)`.
118
 
119
  ``` cpp
120
  template<class charT, class traits>
121
  void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
122
  ```
123
 
124
+ *Effects:* Equivalent to `x.swap(y)`.
125
 
126
  #### Member functions <a id="ifstream.members">[[ifstream.members]]</a>
127
 
128
  ``` cpp
129
  basic_filebuf<charT, traits>* rdbuf() const;
130
  ```
131
 
132
+ *Returns:*
133
+ `const_cast<basic_filebuf<charT, traits>*>(addressof(`*`sb`*`))`.
134
+
135
+ ``` cpp
136
+ native_handle_type native_handle() const noexcept;
137
+ ```
138
+
139
+ *Effects:* Equivalent to: `return rdbuf()->native_handle();`
140
 
141
  ``` cpp
142
  bool is_open() const;
143
  ```
144