# std::basic_istringstream::swap

> C++ Atlas: `cppatlas.com/w/cpp/io/basic_istringstream/swap` | Source: https://en.cppreference.com/w/cpp/io/basic_istringstream/swap | Domain: Input/output | Standards: C++11

Exchanges the state of the stream with those of other.

## Official Specification Summary (cppreference)

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

Exchanges the state of the stream with those of `other`.

This is done by calling `basic_istream<CharT, Traits>::swap(other)` and `rdbuf()->swap(*other.rdbuf())`.

### Parameters

- `other` - stream to exchange the state with

### Return value

(none)

### Exceptions

May throw implementation-defined exceptions.

### Example

> Note: This section is incomplete Reason: no example

### See also

- [`operator=`](https://en.cppreference.com/w/cpp/io/basic_istringstream/operator=) (C++11): moves the string stream (public member function)
- [`swap`](https://en.cppreference.com/w/cpp/io/basic_stringbuf/swap) (C++11): swaps two `basic_stringbuf` objects (public member function of `std::basic_stringbuf<CharT,Traits,Allocator>`)

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