What does STL "rdbuf" method name stand for?

I still wonder what "read buffer" would mean in the context of "std::ostream" (cout).

It's "read" as in "read the value of" or "get the value of" not read as in "read from the stream".

It seems to be a common convention in the old Cfront code, e.g. see the Task library described in the Cfront 2.0 documentation which has several functions named like that, e.g. on page 2-5:

int    rdcount();
int    rdmode();
int    rdmax();
void   setmode(int);
void   setmax(int);

So "rd" and "set" seem to be used for names of getters and setters respectively.

That means the overload of rdbuf(basic_streambuf<C,T>*) that replaces the streambuf is misnamed, it should be setbuf, but that name is already used by the streambuf itself with a different meaning. That rdbuf "setter" overload was added later, the original design only had the "getter", as shown in the STRSTREAM(3C++) manual page at the end of the PDF linked to above:

class strstream : public strstreambase,  public iostream {
public:
                                 strstream();
                                 strstream(char*, int, int mode);
                 strstreambuf*   rdbuf() ;
                 char*           str();
};

Tags:

C++

Stl