std::basic_...tream::swap(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ std::basic_istringstream::swap ✨

okay so this is the man page for std::basic_istringstream::swap β€” yes, both names are literally the same thing, the C++ Standard Library is like that sometimes πŸ’…


🌸 SYNOPSIS 🌸

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

Bestie. This member function has been around since C++11, and what it does is literally exchange the state of the stream with the state of other. Like a friendship bracelet swap but for stream state 🫢

The way it pulls this off? By calling basic_istream<CharT, Traits>::swap(other) and rdbuf()->swap(*other.rdbuf()). Two swaps, one glow-up ✨


πŸŽ€ PARAMETERS πŸŽ€

  • other β€” the stream you wanna exchange state with. your swap buddy, your other half, the one πŸ¦‹

πŸ’– RETURN VALUE πŸ’–

(none) β€” she gives you nothing back, and honestly? iconic. the swap is the gift πŸ‘‘


πŸ”₯ EXCEPTIONS πŸ”₯

May throw implementation-defined exceptions. no cap, that's a "check your implementation, bestie" situation πŸ™ˆ


🌈 EXAMPLE 🌈

This section is incomplete Reason: no example 😭

not me crying over a missing example. the todo list said what it said.


⭐ SEE ALSO ⭐

  • operator= β€” moves the string stream (C++11) (public member function)
  • swap β€” swaps two basic_stringbuf objects (C++11) (public member function of std::basic_stringbuf<CharT,Traits,Allocator>)

πŸ¦‹ CATEGORY πŸ¦‹

  • Todo no example πŸ’€

that's the whole thing, bestie β€” go swap some streams, you got this πŸ’œ

source: cppreference.com Β· version 2024.06.10 β€” mwah, catch you on the next man page πŸ§šβ€β™€οΈπŸŽ€

πŸ“¦ where this page comes from