# std::promise<R>::swap

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

Exchanges the shared states of two promise objects.

## Official Specification Summary (cppreference)

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

Exchanges the shared states of two promise objects.

### Parameters

- `other` - the promise to swap with

### Return value

(none)

### Example

> Note: This section is incomplete Reason: no example

### See also

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

---
Attribution: content from https://en.cppreference.com/w/cpp/thread/promise/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.