From Jason Turner

[ofstream]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpky_qn1my/{from.md → to.md} +24 -35
tmp/tmpky_qn1my/{from.md → to.md} RENAMED
@@ -13,21 +13,21 @@ namespace std {
13
 
14
  // [ofstream.cons], constructors
15
  basic_ofstream();
16
  explicit basic_ofstream(const char* s,
17
  ios_base::openmode mode = ios_base::out);
18
- explicit basic_ofstream(const filesystem::path::value_type* s,
19
- ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
20
  explicit basic_ofstream(const string& s,
21
  ios_base::openmode mode = ios_base::out);
22
  explicit basic_ofstream(const filesystem::path& s,
23
  ios_base::openmode mode = ios_base::out);
24
- basic_ofstream(const basic_ofstream& rhs) = delete;
25
  basic_ofstream(basic_ofstream&& rhs);
26
 
27
  // [ofstream.assign], assign and swap
28
- basic_ofstream& operator=(const basic_ofstream& rhs) = delete;
29
  basic_ofstream& operator=(basic_ofstream&& rhs);
30
  void swap(basic_ofstream& rhs);
31
 
32
  // [ofstream.members], members
33
  basic_filebuf<charT, traits>* rdbuf() const;
@@ -54,63 +54,52 @@ 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
- #### `basic_ofstream` constructors <a id="ofstream.cons">[[ofstream.cons]]</a>
60
 
61
  ``` cpp
62
  basic_ofstream();
63
  ```
64
 
65
- *Effects:* Constructs an object of class
66
- `basic_ofstream<charT, traits>`, initializing the base class with
67
- `basic_ostream(&sb)` and initializing `sb` with
68
- `basic_filebuf<charT, traits>())` ([[ostream.cons]], [[filebuf.cons]]).
69
 
70
  ``` cpp
71
  explicit basic_ofstream(const char* s,
72
  ios_base::openmode mode = ios_base::out);
73
  explicit basic_ofstream(const filesystem::path::value_type* s,
74
  ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
75
  ```
76
 
77
- *Effects:* Constructs an object of class
78
- `basic_ofstream<charT, traits>`, initializing the base class with
79
- `basic_ostream(&sb)` and initializing `sb` with
80
- `basic_filebuf<charT, traits>())` ([[ostream.cons]], [[filebuf.cons]]),
81
- then calls `rdbuf()->open(s, mode | ios_base::out)`. If that function
82
- returns a null pointer, calls `setstate(failbit)`.
83
 
84
  ``` cpp
85
  explicit basic_ofstream(const string& s,
86
  ios_base::openmode mode = ios_base::out);
87
  explicit basic_ofstream(const filesystem::path& s,
88
  ios_base::openmode mode = ios_base::out);
89
  ```
90
 
91
- *Effects:* The same as `basic_ofstream(s.c_str(), mode)`.
92
 
93
  ``` cpp
94
  basic_ofstream(basic_ofstream&& rhs);
95
  ```
96
 
97
- *Effects:* Move constructs from the rvalue `rhs`. This is accomplished
98
- by move constructing the base class, and the contained `basic_filebuf`.
99
- Next `basic_ostream<charT, traits>::set_rdbuf(&sb)` is called to install
100
- the contained `basic_filebuf`.
101
 
102
- #### Assign and swap <a id="ofstream.assign">[[ofstream.assign]]</a>
103
-
104
- ``` cpp
105
- basic_ofstream& operator=(basic_ofstream&& rhs);
106
- ```
107
-
108
- *Effects:* Move assigns the base and members of `*this` from the base
109
- and corresponding members of `rhs`.
110
-
111
- *Returns:* `*this`.
112
 
113
  ``` cpp
114
  void swap(basic_ofstream& rhs);
115
  ```
116
 
@@ -121,19 +110,19 @@ void swap(basic_ofstream& rhs);
121
  template<class charT, class traits>
122
  void swap(basic_ofstream<charT, traits>& x,
123
  basic_ofstream<charT, traits>& y);
124
  ```
125
 
126
- *Effects:* As if by `x.swap(y)`.
127
 
128
  #### Member functions <a id="ofstream.members">[[ofstream.members]]</a>
129
 
130
  ``` cpp
131
  basic_filebuf<charT, traits>* rdbuf() const;
132
  ```
133
 
134
- *Returns:* `const_cast<basic_filebuf<charT, traits>*>(&sb)`.
135
 
136
  ``` cpp
137
  bool is_open() const;
138
  ```
139
 
@@ -145,20 +134,20 @@ void open(const filesystem::path::value_type* s,
145
  ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
146
  ```
147
 
148
  *Effects:* Calls `rdbuf()->open(s, mode | ios_base::out)`. If that
149
  function does not return a null pointer calls `clear()`, otherwise calls
150
- `setstate(failbit)` (which may throw `ios_base::failure`)
151
- ([[iostate.flags]]).
152
 
153
  ``` cpp
154
  void close();
155
  ```
156
 
157
  *Effects:* Calls `rdbuf()->close()` and, if that function fails (returns
158
  a null pointer), calls `setstate(failbit)` (which may throw
159
- `ios_base::failure`) ([[iostate.flags]]).
160
 
161
  ``` cpp
162
  void open(const string& s, ios_base::openmode mode = ios_base::out);
163
  void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
164
  ```
 
13
 
14
  // [ofstream.cons], constructors
15
  basic_ofstream();
16
  explicit basic_ofstream(const char* s,
17
  ios_base::openmode mode = ios_base::out);
18
+ explicit basic_ofstream(const filesystem::path::value_type* s, // wide systems only; see [fstream.syn]
19
+ ios_base::openmode mode = ios_base::out);
20
  explicit basic_ofstream(const string& s,
21
  ios_base::openmode mode = ios_base::out);
22
  explicit basic_ofstream(const filesystem::path& s,
23
  ios_base::openmode mode = ios_base::out);
24
+ basic_ofstream(const basic_ofstream&) = delete;
25
  basic_ofstream(basic_ofstream&& rhs);
26
 
27
  // [ofstream.assign], assign and swap
28
+ basic_ofstream& operator=(const basic_ofstream&) = delete;
29
  basic_ofstream& operator=(basic_ofstream&& rhs);
30
  void swap(basic_ofstream& rhs);
31
 
32
  // [ofstream.members], members
33
  basic_filebuf<charT, traits>* rdbuf() const;
 
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="ofstream.cons">[[ofstream.cons]]</a>
60
 
61
  ``` cpp
62
  basic_ofstream();
63
  ```
64
 
65
+ *Effects:* Initializes the base class with
66
+ `basic_ostream<charT, traits>(addressof(sb))` [[ostream.cons]] and `sb`
67
+ with `basic_filebuf<charT, traits>()` [[filebuf.cons]].
 
68
 
69
  ``` cpp
70
  explicit basic_ofstream(const char* s,
71
  ios_base::openmode mode = ios_base::out);
72
  explicit basic_ofstream(const filesystem::path::value_type* s,
73
  ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
74
  ```
75
 
76
+ *Effects:* Initializes the base class with
77
+ `basic_ostream<charT, traits>(addressof(sb))` [[ostream.cons]] and `sb`
78
+ with `basic_filebuf<charT, traits>()` [[filebuf.cons]], then calls
79
+ `rdbuf()->open(s, mode | ios_base::out)`. If that function returns a
80
+ null pointer, calls `setstate(failbit)`.
 
81
 
82
  ``` cpp
83
  explicit basic_ofstream(const string& s,
84
  ios_base::openmode mode = ios_base::out);
85
  explicit basic_ofstream(const filesystem::path& s,
86
  ios_base::openmode mode = ios_base::out);
87
  ```
88
 
89
+ *Effects:* Equivalent to: `basic_ofstream(s.c_str(), mode)`.
90
 
91
  ``` cpp
92
  basic_ofstream(basic_ofstream&& rhs);
93
  ```
94
 
95
+ *Effects:* Move constructs the base class, and the contained
96
+ `basic_filebuf`. Then calls
97
+ `basic_ostream<charT, traits>::set_rdbuf(addressof(sb))` to install the
98
+ contained `basic_filebuf`.
99
 
100
+ #### Assignment and swap <a id="ofstream.assign">[[ofstream.assign]]</a>
 
 
 
 
 
 
 
 
 
101
 
102
  ``` cpp
103
  void swap(basic_ofstream& rhs);
104
  ```
105
 
 
110
  template<class charT, class traits>
111
  void swap(basic_ofstream<charT, traits>& x,
112
  basic_ofstream<charT, traits>& y);
113
  ```
114
 
115
+ *Effects:* Equivalent to: `x.swap(y)`.
116
 
117
  #### Member functions <a id="ofstream.members">[[ofstream.members]]</a>
118
 
119
  ``` cpp
120
  basic_filebuf<charT, traits>* rdbuf() const;
121
  ```
122
 
123
+ *Returns:* `const_cast<basic_filebuf<charT, traits>*>(addressof(sb))`.
124
 
125
  ``` cpp
126
  bool is_open() const;
127
  ```
128
 
 
134
  ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
135
  ```
136
 
137
  *Effects:* Calls `rdbuf()->open(s, mode | ios_base::out)`. If that
138
  function does not return a null pointer calls `clear()`, otherwise calls
139
+ `setstate(failbit)` (which may throw
140
+ `ios_base::failure`) [[iostate.flags]].
141
 
142
  ``` cpp
143
  void close();
144
  ```
145
 
146
  *Effects:* Calls `rdbuf()->close()` and, if that function fails (returns
147
  a null pointer), calls `setstate(failbit)` (which may throw
148
+ `ios_base::failure`) [[iostate.flags]].
149
 
150
  ``` cpp
151
  void open(const string& s, ios_base::openmode mode = ios_base::out);
152
  void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
153
  ```