From Jason Turner

[polymorphic.assign]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpaegmnftd/{from.md → to.md} +63 -0
tmp/tmpaegmnftd/{from.md → to.md} RENAMED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Assignment <a id="polymorphic.assign">[[polymorphic.assign]]</a>
2
+
3
+ ``` cpp
4
+ constexpr polymorphic& operator=(const polymorphic& other);
5
+ ```
6
+
7
+ *Mandates:* `T` is a complete type.
8
+
9
+ *Effects:* If `addressof(other) == this` is `true`, there are no
10
+ effects. Otherwise:
11
+
12
+ - The allocator needs updating if
13
+ `allocator_traits<Allocator>::propagate_on_container_copy_assignment::value`
14
+ is `true`.
15
+ - If `other` is not valueless, a new owned object is constructed in
16
+ `*this` using `allocator_traits<Allocator>::construct` with the owned
17
+ object from `other` as the argument, using either the allocator in
18
+ `*this` or the allocator in `other` if the allocator needs updating.
19
+ - The previously owned object in `*this`, if any, is destroyed using
20
+ `allocator_traits<Allocator>::destroy` and then the storage is
21
+ deallocated.
22
+ - If the allocator needs updating, the allocator in `*this` is replaced
23
+ with a copy of the allocator in `other`.
24
+
25
+ *Returns:* A reference to `*this`.
26
+
27
+ *Remarks:* If any exception is thrown, there are no effects on `*this`.
28
+
29
+ ``` cpp
30
+ constexpr polymorphic& operator=(polymorphic&& other)
31
+ noexcept(allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
32
+ allocator_traits<Allocator>::is_always_equal::value);
33
+ ```
34
+
35
+ *Mandates:* If `allocator_traits<Allocator>::is_always_equal::value` is
36
+ `false`, `T` is a complete type.
37
+
38
+ *Effects:* If `addressof(other) == this` is `true`, there are no
39
+ effects. Otherwise:
40
+
41
+ - The allocator needs updating if
42
+ `allocator_traits<Allocator>::propagate_on_container_move_assignment::value`
43
+ is `true`.
44
+ - If *`alloc`*` == other.`*`alloc`* is `true`, swaps the owned objects
45
+ in `*this` and `other`; the owned object in `other`, if any, is then
46
+ destroyed using `allocator_traits<Allocator>::destroy` and then the
47
+ storage is deallocated.
48
+ - Otherwise, if *`alloc`*` != other.`*`alloc`* is `true`; if `other` is
49
+ not valueless, a new owned object is constructed in `*this` using
50
+ `allocator_traits<Allocator>::construct` with the owned object from
51
+ `other` as the argument as an rvalue, using either the allocator in
52
+ `*this` or the allocator in `other` if the allocator needs updating.
53
+ - The previously owned object in `*this`, if any, is destroyed using
54
+ `allocator_traits<Allocator>::destroy` and then the storage is
55
+ deallocated.
56
+ - If the allocator needs updating, the allocator in `*this` is replaced
57
+ with a copy of the allocator in `other`.
58
+
59
+ *Returns:* A reference to `*this`.
60
+
61
+ *Remarks:* If any exception is thrown, there are no effects on `*this`
62
+ or `other`.
63
+