czw., 5 gru 2019 o 14:39 Vinnie Falco via Boost
Folks, we are way overthinking the behavior of resize() over capacity(). It throws for a very simple reason. The most obvious and common optimization for highly concurrent network programs is simply to avoid the global allocator. And the obvious and common mitigation for resource exhaustion attacks is to limit the amount of data that an I/O handler is allowed to process.
Using a fixed string as a temporary buffer for an algorithm satisfies both of these goals, and it does so without the caller having to write a bunch of code to check sizes in advance.
Thanks you. This is the kind of information that I was after. I would like to know more. Given that fixed_string does not have operator+, as well as the description above, I am inclined to think that it is not treated as a string, but as a buffer of characters. Next question is, why is a vector with fixed capacity not enough for this purpose? Do you ever have a need to call `.find_first_not_of()` in your use cases? Regards, &rzej;