std::basic_...ic_streambuf(3)

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

πŸ’– NAME πŸ’–

std::basic_streambuf::basic_streambuf β€” std::basic_streambuf::basic_streambuf

okay so this is the page for the std::basic_streambuf constructor, straight from the C++ Standard Libary manual (yes bestie, that's literally how it's spelled up top, and we respect the typo πŸ’…). It's giving very "protected constructor, only my streambuf besties can call me" energy, and honestly? iconic.


πŸ“ Synopsis

protected:                                   (1)
basic_streambuf();
protected:                                   (2) (since C++11)
basic_streambuf(const basic_streambuf& rhs);
  1. (1) β€” constructs the basic_streambuf object, initializes the six pointer members (eback(), gptr(), egptr(), pbase(), pptr(), and epptr()) to null pointer values, and sets the locale member to std::locale(), which is a copy of the global C++ locale at the time of construction. periodt. ✨
  2. (2) β€” since C++11, constructs a copy of rhs, initializing the six pointers and the locale object with copies of the values held by rhs. And bestie, listen: this is a shallow copy β€” the pointers of the newly-constructed basic_streambuf are pointing into the same character array as the pointers of rhs. no cap, same array. 🫢

Both constructors are protected, and are only called by the concrete streambuf classes, such as std::basic_filebuf, std::basic_stringbuf, or std::strstreambuf. so they're like the backstage pass of streambuf land πŸ’…


πŸŽ€ Parameters

  • rhs β€” a streambuf object to copy

πŸ¦‹ Notes

Until C++11, it was unspecified whether basic_streambuf or any of its derived classes is CopyConstructible (LWG issue 421), and different C++ library implementations provided different options. so yeah, that was lowkey a vibe check that different libraries answered differently 😭


🌸 Example

This section is incomplete.

Reason: no example

not me reading "no example" and feeling personally attacked πŸ’€ but okay, we move.

πŸ‘‘ See also

  • constructor β€” constructs a basic_filebuf object (public member function of std::basic_filebuf<CharT,Traits>)
  • constructor β€” constructs a basic_stringbuf object (public member function of std::basic_stringbuf<CharT,Traits,Allocator>)
  • constructor β€” constructs a strstreambuf object (public member function of std::strstreambuf)

πŸ“ Category:

  • Todo no example

That's the whole page, bestie πŸ’– from cppreference.com, version 2024.06.10, page std::basic_...ic_streambuf(3). mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from