From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2019-09-10 14:02:54
On Tue, Sep 10, 2019 at 6:15 AM Phil Endecott via Boost
> I note that the current Beast static_string stores a size_t and
> an array of chars. This is the right approach; it makes it
> trivially-copyable. But if small size is an aim (and I think it
> should be), we can do better; when N < 256, use a uint8_t for the
> size. In fact, use boost::integer::uint_t< log2<N> >::least and
> get an optimal type for the size.
Optimizing for size is not something that I considered, but this would
be possible as per your suggestion.
However, I am interested in a different direction - I'd like to make
as much of the implementation based on ordinary functions (i.e.
non-template) as possible. I often hear complaints from people about
the use of templates in Beast, and in Asio and Networking TS. While
these remarks are often uninformed there are some legitimate concerns,
primarily that compilation resources (both time and space) are
Some ideas include:
* Remove the CharT and Traits template types, who uses these anyway?
* Derive the fixed_string template (which provides the capacity) from
a non-template base class with one pure virtual member, this member is
provided by the derived class and returns the base pointer, size, and
capacity, to permit the optimizations of small size. This of course
adds a pointer (8 or 4 bytes) to the size...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk