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: docs/standard-library/shared-ptr-class.md
+61Lines changed: 61 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -690,6 +690,67 @@ use count == 2
690
690
use count == 1
691
691
```
692
692
693
+
## <aname="swap"></a> swap
694
+
695
+
Swaps two `shared_ptr` objects.
696
+
697
+
```cpp
698
+
voidswap(shared_ptr& sp) noexcept;
699
+
```
700
+
701
+
### Parameters
702
+
703
+
*sp*\
704
+
The shared pointer to swap with.
705
+
706
+
### Remarks
707
+
708
+
The member function leaves the resource originally owned by `*this` subsequently owned by *sp*, and the resource originally owned by *sp* subsequently owned by `*this`. The function does not change the reference counts for the two resources and it does not throw any exceptions.
0 commit comments