From Jason Turner

[ifstream]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpts3c4a41/{from.md → to.md} +18 -12
tmp/tmpts3c4a41/{from.md → to.md} RENAMED
@@ -1,7 +1,9 @@
1
  ### Class template `basic_ifstream` <a id="ifstream">[[ifstream]]</a>
2
 
 
 
3
  ``` cpp
4
  namespace std {
5
  template<class charT, class traits = char_traits<charT>>
6
  class basic_ifstream : public basic_istream<charT, traits> {
7
  public:
@@ -17,18 +19,19 @@ namespace std {
17
  ios_base::openmode mode = ios_base::in);
18
  explicit basic_ifstream(const filesystem::path::value_type* s,
19
  ios_base::openmode mode = ios_base::in);// wide systems only; see [fstream.syn]
20
  explicit basic_ifstream(const string& s,
21
  ios_base::openmode mode = ios_base::in);
22
- explicit basic_ifstream(const filesystem::path& s,
23
- ios_base::openmode mode = ios_base::in);
24
  basic_ifstream(const basic_ifstream&) = delete;
25
  basic_ifstream(basic_ifstream&& rhs);
26
 
27
- // [ifstream.assign], assign and swap
28
  basic_ifstream& operator=(const basic_ifstream&) = delete;
29
  basic_ifstream& operator=(basic_ifstream&& rhs);
 
 
30
  void swap(basic_ifstream& rhs);
31
 
32
  // [ifstream.members], members
33
  basic_filebuf<charT, traits>* rdbuf() const;
34
 
@@ -37,17 +40,14 @@ namespace std {
37
  void open(const filesystem::path::value_type* s,
38
  ios_base::openmode mode = ios_base::in); // wide systems only; see [fstream.syn]
39
  void open(const string& s, ios_base::openmode mode = ios_base::in);
40
  void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
41
  void close();
 
42
  private:
43
  basic_filebuf<charT, traits> sb; // exposition only
44
  };
45
-
46
- template<class charT, class traits>
47
- void swap(basic_ifstream<charT, traits>& x,
48
- basic_ifstream<charT, traits>& y);
49
  }
50
  ```
51
 
52
  The class `basic_ifstream<charT, traits>` supports reading from named
53
  files. It uses a `basic_filebuf<{}charT, traits>` object to control the
@@ -80,38 +80,44 @@ with `basic_filebuf<charT, traits>()` [[filebuf.cons]], then calls
80
  pointer, calls `setstate(failbit)`.
81
 
82
  ``` cpp
83
  explicit basic_ifstream(const string& s,
84
  ios_base::openmode mode = ios_base::in);
85
- explicit basic_ifstream(const filesystem::path& 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
  basic_ifstream(basic_ifstream&& rhs);
93
  ```
94
 
95
  *Effects:* Move constructs the base class, and the contained
96
  `basic_filebuf`. Then calls
97
  `basic_istream<charT, traits>::set_rdbuf(addressof(sb))` to install the
98
  contained `basic_filebuf`.
99
 
100
- #### Assignment and swap <a id="ifstream.assign">[[ifstream.assign]]</a>
101
 
102
  ``` cpp
103
  void swap(basic_ifstream& rhs);
104
  ```
105
 
106
  *Effects:* Exchanges the state of `*this` and `rhs` by calling
107
  `basic_istream<charT, traits>::swap(rhs)` and `sb.swap(rhs.sb)`.
108
 
109
  ``` cpp
110
  template<class charT, class traits>
111
- void swap(basic_ifstream<charT, traits>& x,
112
- basic_ifstream<charT, traits>& y);
113
  ```
114
 
115
  *Effects:* Equivalent to: `x.swap(y)`.
116
 
117
  #### Member functions <a id="ifstream.members">[[ifstream.members]]</a>
 
1
  ### Class template `basic_ifstream` <a id="ifstream">[[ifstream]]</a>
2
 
3
+ #### General <a id="ifstream.general">[[ifstream.general]]</a>
4
+
5
  ``` cpp
6
  namespace std {
7
  template<class charT, class traits = char_traits<charT>>
8
  class basic_ifstream : public basic_istream<charT, traits> {
9
  public:
 
19
  ios_base::openmode mode = ios_base::in);
20
  explicit basic_ifstream(const filesystem::path::value_type* s,
21
  ios_base::openmode mode = ios_base::in);// wide systems only; see [fstream.syn]
22
  explicit basic_ifstream(const string& s,
23
  ios_base::openmode mode = ios_base::in);
24
+ template<class T>
25
+ explicit basic_ifstream(const T& s, ios_base::openmode mode = ios_base::in);
26
  basic_ifstream(const basic_ifstream&) = delete;
27
  basic_ifstream(basic_ifstream&& rhs);
28
 
 
29
  basic_ifstream& operator=(const basic_ifstream&) = delete;
30
  basic_ifstream& operator=(basic_ifstream&& rhs);
31
+
32
+ // [ifstream.swap], swap
33
  void swap(basic_ifstream& rhs);
34
 
35
  // [ifstream.members], members
36
  basic_filebuf<charT, traits>* rdbuf() const;
37
 
 
40
  void open(const filesystem::path::value_type* s,
41
  ios_base::openmode mode = ios_base::in); // wide systems only; see [fstream.syn]
42
  void open(const string& s, ios_base::openmode mode = ios_base::in);
43
  void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
44
  void close();
45
+
46
  private:
47
  basic_filebuf<charT, traits> sb; // exposition only
48
  };
 
 
 
 
49
  }
50
  ```
51
 
52
  The class `basic_ifstream<charT, traits>` supports reading from named
53
  files. It uses a `basic_filebuf<{}charT, traits>` object to control the
 
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>