C++: Best text accumulator
- by MInner
Text gets accumulates piecemeal before being sent to client.
Now we use own class that allocates memory for each piece as char massive. (Anyway, works like char[][] + std::list<char*>).
Then we build the whole string, convert it into std::sting and then create boost::asio::streambuf using it. That's slow enough, I assume. Correct me if I'm wrong.
I know, in many cases simple FILE type from stdio.h is used. How does it works? Allocates memory at every write into it. So, is it faster and is there any way to read into boost::asio::streambuf from FILE?