#include#include #include int main() { std::string str = "Hello World!"; std::stringbuf buf(str); std::cout << buf.str() << std::endl; return 0; }
#includeThis example demonstrates how to use the `<<` operator to append text to a StringBuffer object. In this example, the `<<` operator is used twice to add "Hello" and "World!" to the buffer, respectively. Package/Library: Standard Template Library (STL)#include #include int main() { std::stringbuf buf; buf << "Hello"; buf << " World!"; std::cout << buf.str() << std::endl; return 0; }