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

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

πŸ’… NAME

std::basic_spanstream::operator= β€” bestie, it's the assignment operator for std::basic_spanstream, and it's giving "move only, no copies, we don't do that here" energy πŸ’–

This one lives in the C++ Standard Library man pages (yes, the actual official one, not a random blog post from 2009, iykyk) ✨


🌸 SYNOPSIS

basic_spanstream& operator=( basic_spanstream&& other );         (1)
(since C++23)

basic_spanstream& operator=( const basic_spanstream& ) = delete; (2)
(since C++23)

So there's literally two of them and only one of them actually works 🫢

  1. This one move assigns other into *this β€” and the way it does that is by effectively move-assigning both the std::basic_iostream base class subobject and the wrapped std::basic_spanbuf πŸ”₯
  2. This one is the copy assignment operator and it's deleted. basic_spanstream is not copy assignable, periodt. No cap, no copies, no exceptions πŸ’€
Heads up bestie πŸŽ€ note that the move assignment operator of the base class swaps all stream state variables (except for rdbuf()) between *this and other. That's the whole vibe.
Okay and also β€” 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, okay?

✨ PARAMETERS

  • other β€” another stream to move from πŸ¦‹ (that's it, that's the whole parameter list, she's simple like that)

πŸ’œ RETURN VALUE

*this β€” she gives herself back, main character energy honestly πŸ‘‘


🌈 EXCEPTIONS

May throw implementation-defined exceptions. So like, it might, it's not a promise either way, check your implementation 😭


πŸ“ EXAMPLE

This section is incomplete.

Reason: no example πŸ’€ (tragic, I know, the one thing we all wanted)


🧚 SEE ALSO

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

πŸ“Œ CATEGORY

  • Todo: no example 🌸

Okay that's the whole page bestie, go forth and move-assign responsibly πŸ’…βœ¨

Source and version and date, for the record: http://cppreference.com, 2024.06.10, and the page is std::basic_...::operator=(3) β€” mwah, love u, bye πŸ«ΆπŸ’–πŸ¦‹

πŸ“¦ where this page comes from