tmp/tmpnjgb_fg8/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="ofstream.general">[[ofstream.general]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
template<class charT, class traits = char_traits<charT>>
|
| 6 |
+
class basic_ofstream : public basic_ostream<charT, traits> {
|
| 7 |
+
public:
|
| 8 |
+
using char_type = charT;
|
| 9 |
+
using int_type = typename traits::int_type;
|
| 10 |
+
using pos_type = typename traits::pos_type;
|
| 11 |
+
using off_type = typename traits::off_type;
|
| 12 |
+
using traits_type = traits;
|
| 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 |
+
template<class T>
|
| 23 |
+
explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
|
| 24 |
+
basic_ofstream(const basic_ofstream&) = delete;
|
| 25 |
+
basic_ofstream(basic_ofstream&& rhs);
|
| 26 |
+
|
| 27 |
+
basic_ofstream& operator=(const basic_ofstream&) = delete;
|
| 28 |
+
basic_ofstream& operator=(basic_ofstream&& rhs);
|
| 29 |
+
|
| 30 |
+
// [ofstream.swap], swap
|
| 31 |
+
void swap(basic_ofstream& rhs);
|
| 32 |
+
|
| 33 |
+
// [ofstream.members], members
|
| 34 |
+
basic_filebuf<charT, traits>* rdbuf() const;
|
| 35 |
+
|
| 36 |
+
bool is_open() const;
|
| 37 |
+
void open(const char* s, ios_base::openmode mode = ios_base::out);
|
| 38 |
+
void open(const filesystem::path::value_type* s,
|
| 39 |
+
ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
|
| 40 |
+
void open(const string& s, ios_base::openmode mode = ios_base::out);
|
| 41 |
+
void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
|
| 42 |
+
void close();
|
| 43 |
+
|
| 44 |
+
private:
|
| 45 |
+
basic_filebuf<charT, traits> sb; // exposition only
|
| 46 |
+
};
|
| 47 |
+
}
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
The class `basic_ofstream<charT, traits>` supports writing to named
|
| 51 |
+
files. It uses a `basic_filebuf<{}charT, traits>` object to control the
|
| 52 |
+
associated sequence. For the sake of exposition, the maintained data is
|
| 53 |
+
presented here as:
|
| 54 |
+
|
| 55 |
+
- `sb`, the `filebuf` object.
|
| 56 |
+
|