You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/cpp/concepts/unordered-set/terms/swap/swap.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,23 +13,23 @@ CatalogContent:
13
13
- 'paths/computer-science'
14
14
---
15
15
16
-
The **`swap()`** method exchanges the contents of one [`unordered_set`](https://www.codecademy.com/resources/docs/cpp/unordered-set) with another. This operation runs in constant time because it swaps internal structures rather than moving individual elements.
16
+
The **`swap()`** method exchanges the contents of one [`unordered_set`](https://www.codecademy.com/resources/docs/cpp/unordered-set) with another. This operation runs in constant time by swapping internal structures rather than moving individual elements.
17
17
18
18
After the swap, both containers take ownership of each other's elements. Iterators and references remain valid but now refer to elements stored in the opposite container.
19
19
20
-
The two unordered sets need not have the same size but should have the same template parameters.
20
+
The two `unordered_set` containers do not need to have the same size, but they must be of the same type.
21
21
22
22
## Syntax
23
23
24
-
The `swap()` method can be used with the following syntax:
24
+
The `swap()` method can be used in the following syntax:
0 commit comments