std::ios_base::operator=(3)

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

✨ NAME ✨

std::ios_base::operator= β€” bestie, the name line is literally std::ios_base::operator= - std::ios_base::operator=. This is the C++ Standard Libary manual page for it, and we are about to vibe-check a very important little "nope" πŸ’…

πŸ¦‹ Synopsis πŸ¦‹

Okay so here's the whole signature situation, copied exactly because we do not mess with code:

          private:                                          (until C++11)
          ios_base& operator=( const ios_base& );
          public:                                           (since C++11)
          ios_base& operator=( const ios_base& ) = delete;

The copy assignment operator is private (until C++11), deleted (since C++11): streams are not copy-assignable. No cap, that's the whole mood β€” you cannot copy-assign these cuties 😭

🌸 Defect reports 🌸

The following behavior-changing defect reports were applied retroactively to previously published C++ standards. Iconic retroactive lore, honestly ✨

  • DR: LWG 50 β€” Applied to: C++98 β€” Behavior as published: the copy assignment operator was not specified as private β€” Correct behavior: specified.

Sign-off tea 🫢: this page came from http://cppreference.com, version/date 2024.06.10, and its manual-page name is std::ios_base::operator=(3). Slay, go forth and do not copy-assign streams πŸ’–

πŸ“¦ where this page comes from