我正在尝试了解 IO 流的结构。
从 cppreference std::basic_stringstream::str 开始:
Manages the contents of the underlying string object.
1) Returns a copy of the underlying string as if by calling
rdbuf()->str()
.
rdbuf()
返回一个 std::basic_streambuf
对象,但我在 https://en.cppreference.com/w/cpp/io/basic_streambuf 中找不到 str()
成员函数。
最佳答案
仔细再看一遍。 std::basic_stringstream::rdbuf()
实际上返回一个指向 std::basic_stringbuf
的指针, 不是指向 std::basic_streambuf
的指针正如你所说。
str()
是 std:::basic_stringbuf
的一种方法.
关于c++ - rdbuf()->str() 在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51094368/