# std::basic_istringstream::swap

C++
 Compiler support Freestanding and hosted Language Standard library headers Named requirements Feature test macros (C++20) Language support library Concepts library (C++20) Diagnostics library General utilities library Strings library Containers library Iterators library Ranges library (C++20) Algorithms library Numerics library Localizations library Input/output library Filesystem library (C++17) Regular expressions library (C++11) Atomic operations library (C++11) Thread support library (C++11) Technical specifications Symbols index External libraries

Input/output library
 I/O manipulators C-style I/O Buffers basic_streambuf basic_filebuf basic_stringbuf basic_spanbuf(C++23) strstreambuf(deprecated in C++98) basic_syncbuf(C++20) Streams Abstractions ios_base basic_ios basic_istream basic_ostream basic_iostream File I/O basic_ifstream basic_ofstream basic_fstream String I/O basic_istringstream basic_ostringstream basic_stringstream Array I/O basic_ispanstream(C++23) basic_ospanstream(C++23) basic_spanstream(C++23) istrstream(deprecated in C++98) ostrstream(deprecated in C++98) strstream(deprecated in C++98) Synchronized Output basic_osyncstream(C++20) Types streamoff streamsize fpos Error category interface iostream_category(C++11) io_errc(C++11)

std::basic_istringstream
 Member functions basic_istringstream::basic_istringstream basic_istringstream::operator= basic_istringstream::swap(C++11) basic_istringstream::rdbuf String operations basic_istringstream::str basic_istringstream::view(C++20) Non-member functions

 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()).

## Contents

### Parameters

 other - stream to exchange the state with

(none)

### Exceptions

May throw implementation-defined exceptions.

### Example

 operator=(C++11) moves the string stream (public member function)  swap(C++11) swaps two basic_stringbuf objects (public member function of std::basic_stringbuf)
{"ft_lang_label":"__label__en","ft_lang_prob":0.7123188,"math_prob":0.4268765,"size":721,"snap":"2021-31-2021-39","text_gpt3_token_len":187,"char_repetition_ratio":0.14225942,"word_repetition_ratio":0.0,"special_character_ratio":0.25381416,"punctuation_ratio":0.15517241,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96258026,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-26T03:09:05Z\",\"WARC-Record-ID\":\"<urn:uuid:7c227363-7156-4beb-a510-87c1d372202c>\",\"Content-Length\":\"42833\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:d995c1d4-e49a-4f35-ac95-a6669e357a4d>\",\"WARC-Concurrent-To\":\"<urn:uuid:667bc5b0-a450-402d-857c-48f33b32bda6>\",\"WARC-IP-Address\":\"74.114.90.46\",\"WARC-Target-URI\":\"https://en.cppreference.com/w/cpp/io/basic_istringstream/swap\",\"WARC-Payload-Digest\":\"sha1:2QVJ7L4QPRFODKHVDIKFRULEYUBJV65H\",\"WARC-Block-Digest\":\"sha1:KMI4WFB2YCGHHB6B7KBE65DLQUWHRXTQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780057796.87_warc_CC-MAIN-20210926022920-20210926052920-00575.warc.gz\"}"}