Boost logo

Boost :

From: Janson R. (mlists.aerostun_at_[hidden])
Date: 2020-03-10 02:47:29


On 10/03/2020 03:30, Gavin Lambert via Boost wrote:
> Forthcoming std::span might be another interesting candidate.

That's for sure; I'll experiment with it more this week

> While it works (and I do sometimes use it myself if I'm especially lazy)
> I dislike use of std::string and friends for arbitrary binary data.

You've definitely caught the "lazy" aspect that went into it; was mostly
for checking how usable a solution of that form is. I have a user and he
happens to use strings so I just went with the most straightforward way
to let him use the library and for myself to test it.

> std::vector<uint8_t> is probably the best standard container type for a
> basic block-o-bytes, absent generic template buffer concept magic and/or
> C++20 spans.

You've just given me the idea of making a catch-all span-like that takes
any contiguous range of `char` or `unsigned char` and turns it into a
lightweight span that can be used in ABI boundaries. I'll try that
tomorrow; thanks for the feedback on possible input types!

All of this C++20 mindset made me wonder if a codec API could be almost
as simple and elegant as making it into a range adaptor (requiring
memory contiguity of course); what do you and possibly other readers
think of that?

Regards,

Janson


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