Boost logo

Boost :

Subject: Re: [boost] [Beast] Questions Before Review
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2017-06-25 21:48:49


On Sun, Jun 25, 2017 at 2:36 PM, Niall Douglas via Boost
<boost_at_[hidden]> wrote:
> Where you need to consume or produce arbitrary scatter-gather buffers,
> use gsl::span<T> or equivalent.

As gsl::span<> is only capable of representing ranges of elements
contiguous in memory, it is not capable of representing the majority
of Beast's buffer sequences. Examples:

https://github.com/vinniefalco/Beast/blob/8982e14aa65b9922ac5a00e5a5196a08dfa8f29e/include/beast/http/impl/fields.ipp#L103

https://github.com/vinniefalco/Beast/blob/8982e14aa65b9922ac5a00e5a5196a08dfa8f29e/include/beast/core/buffer_cat.hpp#L17

https://github.com/vinniefalco/Beast/blob/8982e14aa65b9922ac5a00e5a5196a08dfa8f29e/include/beast/core/impl/multi_buffer.ipp#L121

Using gsl::span<> effectively type-erases the buffer sequence which is
inefficient, since it must be copied to a vector equivalent in order
to be used.

>I certainly can see that char iterators are going to get used a lot

Beast never templates on the character type. All operations on
structured data (for example HTTP headers) are performed on a single
contiguous memory buffer of chars. This is done for performance
reasons.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk