# std::swap(std::basic_stacktrace)

> C++ Atlas: `cppatlas.com/w/cpp/utility/basic_stacktrace/swap2` | Source: https://en.cppreference.com/w/cpp/utility/basic_stacktrace/swap2 | Domain: Utility | Standards: C++23

Specializes the std::swap algorithm for std::basic_stacktrace. Swaps the contents of lhs and rhs. Equivalent to lhs.swap(rhs);.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <stacktrace>

template< class Allocator >
void swap( std::basic_stacktrace<Allocator>& lhs, std::basic_stacktrace<Allocator>& rhs )
    noexcept(noexcept(lhs.swap(rhs))); // (since C++23)
```

Specializes the `std::swap` algorithm for `std::basic_stacktrace`. Swaps the contents of `lhs` and `rhs`. Equivalent to `lhs.swap(rhs);`.

### Parameters

- `lhs, rhs` - stacktraces whose contents to swap

### Return value

(none)

### Complexity

Constant.

### Example

> Note: This section is incomplete Reason: no example

### See also

- [`swap`](https://en.cppreference.com/w/cpp/utility/basic_stacktrace/swap): swaps the contents (public member function)

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