
Rodrigo Baroni wrote:
I just have one doubt now: The output to a std::string (that has internal variable size, and so, maybe use some linked queue, or whatever I guess), or to output to a pre-alocated buffer?
Shouldn't be, in some cases where this task is done a lot of times in a loop (like is the case - where I'm doing compression of frames in a streaming video server) be more faster and better to output to memory directly in a pre-alocated buffer?
Possibly; you'd have to measure it. If you use a vector and call reserve(), I
doubt you'll notice any difference.
It's also easy to write an array_sink that counts the number of characters that
have been written to it. There's an example implementation at