std::swap(s...tringstream)(3)
π std::swap(std::basic_istringstream) π
okay bestie so this page lives in the C++ Standard Library manual (yes, the whole std::swap(s...tringstream)(3) situation) and it's honestly a tiny little glow-up of a function. let me break it down π«Ά
β¨ NAME β¨
std::swap(std::basic_istringstream) β literally what it says on the tin: the swap for std::basic_istringstream. no cap, that's the whole name, twice, because the manpage said it twice and I would never gatekeep a single character from you π
πΈ Synopsis πΈ
okay so, this one's Defined in header <sstream> β that's where it lives, don't forget to include it or nothing works, periodt.
template< class CharT, class Traits, class Alloc >
void swap( std::basic_istringstream<CharT,Traits,Alloc>& lhs,
(since C++11)
std::basic_istringstream<CharT,Traits,Alloc>& rhs );
so what does it do? it Overloads the std::swap algorithm for std::basic_istringstream. β like, it's the special swap just for these stream girls π
it Exchanges the state of lhs with that of rhs. β effectively calls lhs.swap(rhs). that's it, that's the vibe. two streams trade states, everyone goes home happy β¨
quick note bestie: this overload is (since C++11) β if you're time-traveling to C++03, this one's not there for you π
π Parameters π
lhs, rhsβ streams whose state to swap β yeah, just the two streams swapping their whole situation. give them a minute π
π¦ Return value π¦
(none) β nothing comes back. void behavior, zero notes, it just does the thing π
β Exceptions β
May throw implementation-defined exceptions. β so like, it might throw, and what exactly it throws depends on your implementation. no promises, no cap, just vibes π₯
π Example π
big yikes: This section is incomplete
Reason: no example ππ the manpage really said "figure it out bestie" β so yeah, there's no example here. not me crying over an empty example section fr fr π
π See also π
swapβ swaps two string streams, and it's a(C++11)public member function. that's the member-function bestie to this free-function one π«Ά
π Category π
* Todo no example
like, the category itself is calling out the missing example. it's giving self-aware π
okay that's the whole page, you ate that, no crumbs left π this iconic little doc came from http://cppreference.com, dated 2024.06.10, and it's filed under std::swap(s...tringstream)(3) β go forth and swap those stream states, bestie πβ¨π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms