开发者

C++: Best text accumulator

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?

ADD: Hm. I've forgot one big thing :). The compilation of dlls and main application is made under few compilers, so it should have no stl stuff inside it ... Because it usually cause a lot of problems, while executing dlls.


I have no idea how efficient it is, but I usually use a ostringstream for that sort of thing


Check out http://www.sgi.com/tech/stl/Rope.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜