std::basic_...sic_filebuf(3)

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

πŸ’– NAME πŸ’–

std::basic_filebuf::~basic_filebuf β€” bestie, this is literally the destructor for std::basic_filebuf, and yes the page header is doing that cursed std::basic_...sic_filebuf(3) abbreviation thing again (iykyk, it's the C++ Standard Libary man page, we don't talk about the typo πŸ’€).


✨ Synopsis ✨

virtual ~basic_filebuf();

Okay so real talk: it calls close() to close the associated file, and then destructs all the other members of basic_filebuf. That's the whole vibe check.

And the important part πŸ‘‘: if an exception happens during the destruction of the object β€” including inside that call to close() β€” it gets caught and not rethrown. No drama, no surprise throws escaping a destructor, we simply do not allow that energy here πŸ’….

πŸŽ€ Parameters πŸŽ€

(none) β€” not a single one, she takes no arguments, main character energy fr fr πŸ¦‹

🌸 Return value 🌸

(none) β€” destructors don't return things, that's just how it is, periodt ✨

🧚 Notes 🧚

Typically called by the destructor of std::basic_fstream. So like, you're probably never calling this yourself β€” your fstream is out here doing it for you behind the scenes 🫢.

πŸ“ Example πŸ“

This section is incomplete.

Reason: no example πŸ™ˆ

(yes bestie, the page literally says that, I'm not gatekeeping an example from you, there just isn't one 😭)

πŸ’œ Defect reports πŸ’œ

The following behavior-changing defect reports were applied retroactively to previously published C++ standards. Retroactive glow-ups, we love to see it 🌈

  • LWG 622 β€” applied to C++98 β€” the behavior as published was that it was unclear how to handle the exception thrown during destruction; the correct behavior is that it is caught but not rethrown πŸ’–

⭐ See also ⭐

  • constructor β€” constructs a basic_filebuf object (public member function)
  • close β€” flushes the put area buffer and closes the associated file (public member function)

πŸ’€ Category:

  • Todo no example

Category: Todo no example β€” she's a work in progress icon, we stan anyway πŸ‘‘

Source/version and date, as promised: this gem came from http://cppreference.com, dated 2024.06.10 πŸŽ€ Go drink some water and close your file streams, bestie πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from