From Jason Turner

[polymorphic.swap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpld_jjchh/{from.md → to.md} +29 -0
tmp/tmpld_jjchh/{from.md → to.md} RENAMED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Swap <a id="polymorphic.swap">[[polymorphic.swap]]</a>
2
+
3
+ ``` cpp
4
+ constexpr void swap(polymorphic& other)
5
+ noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value ||
6
+ allocator_traits<Allocator>::is_always_equal::value);
7
+ ```
8
+
9
+ *Preconditions:* If
10
+ `allocator_traits<Allocator>::propagate_on_container_swap::value` is
11
+ `true`, then `Allocator` meets the *Cpp17Swappable* requirements.
12
+ Otherwise `get_allocator() == other.get_allocator()` is `true`.
13
+
14
+ *Effects:* Swaps the states of `*this` and `other`, exchanging owned
15
+ objects or valueless states. If
16
+ `allocator_traits<Allocator>::propagate_on_container_swap::value` is
17
+ `true`, then the allocators of `*this` and `other` are exchanged by
18
+ calling `swap` as described in  [[swappable.requirements]]. Otherwise,
19
+ the allocators are not swapped.
20
+
21
+ [*Note 1*: Does not call `swap` on the owned objects
22
+ directly. — *end note*]
23
+
24
+ ``` cpp
25
+ constexpr void swap(polymorphic& lhs, polymorphic& rhs) noexcept(noexcept(lhs.swap(rhs)));
26
+ ```
27
+
28
+ *Effects:* Equivalent to `lhs.swap(rhs)`.
29
+