C ++: best text storage

The text is accumulated in parts before being sent to the client.

Now we use our own class, which allocates memory for each part as a massive char array. (In any case, it works like char[][]+ std::list<char*>).

Then we build the entire string, convert it to std :: sting, and then create boost::asio::streambufit using it. I guess this is slow enough. Correct me if I am wrong.

I know in many cases a simple type FILEof is used stdio.h. How it works? Allocates memory each time it is written to it. So this is faster and is there a way to read in boost::asio::streambuffrom FILE?

ADD : Hm. I forgot one big thing :). The compilation of the DLL and the main application is performed in several compilers, therefore, it should not have any stl files inside ... Because this usually causes a lot of problems when executing the DLL.

+3
source share
2 answers

I don’t know how effective it is, but I usually use ostringstream for this kind of thing

+3
source

Source: https://habr.com/ru/post/1736121/


All Articles