From Jason Turner

[any.assign]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpnibi4i05/{from.md → to.md} +47 -0
tmp/tmpnibi4i05/{from.md → to.md} RENAMED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Assignment <a id="any.assign">[[any.assign]]</a>
2
+
3
+ ``` cpp
4
+ any& operator=(const any& rhs);
5
+ ```
6
+
7
+ *Effects:* As if by `any(rhs).swap(*this)`. No effects if an exception
8
+ is thrown.
9
+
10
+ *Returns:* `*this`.
11
+
12
+ *Throws:* Any exceptions arising from the copy constructor for the
13
+ contained value.
14
+
15
+ ``` cpp
16
+ any& operator=(any&& rhs) noexcept;
17
+ ```
18
+
19
+ *Effects:* As if by `any(std::move(rhs)).swap(*this)`.
20
+
21
+ *Returns:* `*this`.
22
+
23
+ *Postconditions:* The state of `*this` is equivalent to the original
24
+ state of `rhs` and `rhs` is left in a valid but otherwise unspecified
25
+ state.
26
+
27
+ ``` cpp
28
+ template<class T>
29
+ any& operator=(T&& rhs);
30
+ ```
31
+
32
+ Let `VT` be `decay_t<T>`.
33
+
34
+ *Requires:* `VT` shall satisfy the `CopyConstructible` requirements.
35
+
36
+ *Effects:* Constructs an object `tmp` of type `any` that contains an
37
+ object of type `VT` direct-initialized with `std::forward<T>(rhs)`, and
38
+ `tmp.swap(*this)`. No effects if an exception is thrown.
39
+
40
+ *Returns:* `*this`.
41
+
42
+ *Remarks:* This operator shall not participate in overload resolution
43
+ unless `VT` is not the same type as `any` and
44
+ `is_copy_constructible_v<VT>` is `true`.
45
+
46
+ *Throws:* Any exception thrown by the selected constructor of `VT`.
47
+