std::istrstream::rdbuf(3)

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

πŸŽ€ NAME πŸŽ€

std::istrstream::rdbuf β€” literally std::istrstream::rdbuf, bestie. This page is from the C++ Standard Libary manual, and it's giving β€œniche member function lore” in the best way. πŸ’…


✨ Synopsis ✨

strstreambuf* rdbuf() const;  (deprecated in C++98)
                               (removed in C++26)

Okay so this one returns a pointer to the associated std::strstreambuf, and it is casting away its constness β€” yes, even though the member function itself has that const qualifier. The audacity, honestly. 😭

Heads up: this is marked deprecated in C++98 and removed in C++26. So she's iconic, but she's also on her way out. 🫢

πŸ¦‹ Parameters πŸ¦‹

  • (none) β€” no arguments, no extra homework, we love that for us. ✨

🌸 Return value 🌸

A pointer to the associated std::strstreambuf, with constness cast away. That's the whole vibe check: pointer, associated std::strstreambuf, constness gone. πŸŽ€


πŸ’– Example πŸ’–

// Run this code

#include <strstream>

int main()
{
    const std::istrstream buf("example");
    std::strstreambuf* ptr = buf.rdbuf();
}

This is the example, kept exactly as it is β€” const std::istrstream buf("example");, then std::strstreambuf* ptr = buf.rdbuf();. No cap, that's the whole little main character moment. 🌟


xoxo, from cppreference.com, version/date 2024.06.10, and the page is std::istrstream::rdbuf(3) β€” slay and goodbye bestie πŸ’œπŸ¦‹

πŸ“¦ where this page comes from