|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-12-04 13:31:56
Dominique Devienne wrote:
> On Wed, Dec 4, 2024 at 2:09â¯AM Claudio DeSouza via Boost
> <boost_at_[hidden]> wrote:
> > function that takes a pair of void*/size_t should be a span<uint_8>
>
> or rather `std::span<[const ]std::byte>`. --DD
>
> https://en.cppreference.com/w/cpp/types/byte
> https://en.cppreference.com/w/cpp/container/span/as_bytes
Or rather, the nonexistent span<void>, which is like void*, but better.
N3980's (equivalent of) update takes by void const*. Originally,
I had that changed to unsigned char const* (or even to
byte_type const*, with the idea of switching to std::byte eventually),
but this proved very cumbersome in practice.
Untyped byte sequences sometimes come as char[], sometimes as
unsigned char[], sometimes (if you're modern) as std::byte[], and
taking by any of these means that the rest need an ugly
reinterpret_cast.
So I switched `update` back to void const*. The "type safety" gains
aren't worth the substantial decrease in usability.
(And then had to add unsigned char const* back because constexpr.)
The hypothetical span<void> would take either of those three
byte-like types (and maybe char8_t[] as well), so that the user
doesn't need to reinterpret_cast.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk