std::basic_...m::operator=(3)

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

πŸ’… std::basic_ospanstream::operator= (3) β€” straight out of the C++ Standard Libary, bestie

Okay so this one's from the C++ Standard Libary manpage, section 3, and it's literally all about std::basic_ospanstream::operator= β€” yes that's the whole name, no I'm not shortening it, it's iconic like that. πŸŽ€


✨ NAME ✨

std::basic_ospanstream::operator= β€” literally what it says on the tin, the assignment operators for std::basic_ospanstream. That's it, that's the name. πŸ‘‘


🌸 SYNOPSIS 🌸

basic_ospanstream& operator=( basic_ospanstream&& other );

(1) (since C++23)

basic_ospanstream& operator=( const basic_ospanstream& ) = delete;

(2) (since C++23)

ngl bestie the = delete on overload 2 is doing so much heavy lifting, we love a firm boundary. 🚧


πŸ¦‹ DESCRIPTION πŸ¦‹

Ok so let's break down the two overloads, no cap:

1) Move assigns other to *this β€” which effectively move-assigns both the std::basic_ostream base class subobject and the wrapped std::basic_spanbuf. Two for the price of one, periodt. ✨

2) The copy assignment operator is deleted. basic_ospanstream is not copy assignable. She said "no copies, only vibes." πŸ’…

Heads up though: note that the move assignment operator of the base class swaps all stream state variables (except for rdbuf()) between *this and other. Not just the cute ones β€” all of them. πŸ‘€

And this one's important, so pay attention: it is implementation-defined whether the std::basic_spanbuf wrapped in other still holds an underlying buffer after the move assignment. So like… don't assume. It's giving "mystery box" energy and honestly that's the standard's business, not ours. πŸ™ˆ


🧚 PARAMETERS 🧚

  • other β€” another stream to move from 🫢

⭐ RETURN VALUE ⭐

*this β€” she returns herself, main character energy fr fr. πŸ‘‘


πŸ”₯ EXCEPTIONS πŸ”₯

May throw implementation-defined exceptions. So like, it might throw, but which ones? Implementation-defined, bestie. Nobody knows, it's a surprise. 😭


πŸ“ EXAMPLE πŸ“

This section is incomplete.

Reason: no example. πŸ’€ Not me showing up to an example section with no example. The audacity. (It's in the Todo category, so like… known issue, we move.)


🌈 SEE ALSO 🌈

  • operator= β€” assigns a basic_spanbuf object (C++23) (public member function of std::basic_spanbuf<CharT,Traits>)
  • operator= β€” move-assigns from another basic_ostream (C++11) (protected member function)

πŸ’œ CATEGORY πŸ’œ

  • Todo β€” no example 😭 (yep, still not over it)

That's the whole page, bestie β€” no details left behind, we ate and left absolutely no crumbs. 🍽️✨

Oh and one last thing β€” this iconic little document comes from http://cppreference.com, dated 2024.06.10, filed under std::basic_...m::operator=(3). Go forth and move-assign responsibly. πŸ«ΆπŸ’–

πŸ“¦ where this page comes from