Date: 2019-09-13 10:28:32
"Vinnie Falco via Boost" <boost_at_[hidden]> â 12 septembre 2019 16:06
> On Thu, Sep 12, 2019 at 6:19 AM Mike via Boost <boost_at_[hidden]> wrote:
> > Not sure, if this counts as substantial...
> Yes it does, pretty much anything that is not simply cosmetic (i.e.
> naming) is substantial :)
> > a) to make the string trivially copyable (simply copy the whole
> > storage, not just the bytes actually containing the string).
> > This might make things easier for the optimizer.
> The purpose of fixed_capacity_string (see what I did there? LOL) is to
> facilitate allocation-free string mutation when the algorithm can
> reasonably impose an upper limit on the size of the resulting string.
> For example, Beast imposes an generous upper limit on some of the
> elements which make up the HTTP header. This allows the parser to use
> a stack based string to perform calculations and avoid allocations.
Why not use a static_vector<char> ?
In my experiments replacing strings by vectors of chars has always been a good idea. There is a cost associated with maintaining the null termination of strings, and in some context it is measureable. Given that any modern non-owning interface should use string_view rather than a plain char const*, it seems that it is only when interoperating with C that such a class would be useful.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk