From Jason Turner

[fs.op.copy.file]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp13tbnejc/{from.md → to.md} +50 -0
tmp/tmp13tbnejc/{from.md → to.md} RENAMED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Copy file <a id="fs.op.copy.file">[[fs.op.copy.file]]</a>
2
+
3
+ ``` cpp
4
+ bool copy_file(const path& from, const path& to);
5
+ bool copy_file(const path& from, const path& to, error_code& ec);
6
+ ```
7
+
8
+ *Returns:* `copy_file(from, to, copy_options::none)` or
9
+ `copy_file(from, to, copy_options::none, ec)`, respectively.
10
+
11
+ *Throws:* As specified in  [[fs.err.report]].
12
+
13
+ ``` cpp
14
+ bool copy_file(const path& from, const path& to, copy_options options);
15
+ bool copy_file(const path& from, const path& to, copy_options options,
16
+ error_code& ec);
17
+ ```
18
+
19
+ *Preconditions:* At most one element from each option
20
+ group [[fs.enum.copy.opts]] is set in `options`.
21
+
22
+ *Effects:* As follows:
23
+
24
+ - Report an error as specified in  [[fs.err.report]] if:
25
+ - `is_regular_file(from)` is `false`, or
26
+ - `exists(to)` is `true` and `is_regular_file(to)` is `false`, or
27
+ - `exists(to)` is `true` and `equivalent(from, to)` is `true`, or
28
+ - `exists(to)` is `true` and
29
+ ``` cpp
30
+ (options & (copy_options::skip_existing |
31
+ copy_options::overwrite_existing |
32
+ copy_options::update_existing)) == copy_options::none
33
+ ```
34
+ - Otherwise, copy the contents and attributes of the file `from`
35
+ resolves to, to the file `to` resolves to, if:
36
+ - `exists(to)` is `false`, or
37
+ - `(options & copy_options::overwrite_existing) != copy_options::none`,
38
+ or
39
+ - `(options & copy_options::update_existing) `` `` != copy_options::none`
40
+ and `from` is more recent than `to`, determined as if by use of the
41
+ `last_write_time` function [[fs.op.last.write.time]].
42
+ - Otherwise, no effects.
43
+
44
+ *Returns:* `true` if the `from` file was copied, otherwise `false`. The
45
+ signature with argument `ec` returns `false` if an error occurs.
46
+
47
+ *Throws:* As specified in  [[fs.err.report]].
48
+
49
+ *Complexity:* At most one direct or indirect invocation of `status(to)`.
50
+