# std::packaged_task<R(Args...)>::swap

> C++ Atlas: `cppatlas.com/w/cpp/thread/packaged_task/swap` | Source: https://en.cppreference.com/w/cpp/thread/packaged_task/swap | Domain: Concurrency support | Standards: C++11

Exchanges the shared states and stored tasks of *this and other.

## Official Specification Summary (cppreference)

```cpp
void swap( packaged_task& other ) noexcept; // (since C++11)
```

Exchanges the shared states and stored tasks of `*this` and `other`.

### Parameters

- `other` - packaged task whose state to swap with

### Return value

(none)

### See also

- [`std::swap(std::packaged_task)`](https://en.cppreference.com/w/cpp/thread/packaged_task/swap2) (C++11): specializes the `std::swap` algorithm (function template)

---
Attribution: content from https://en.cppreference.com/w/cpp/thread/packaged_task/swap (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.