|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-12-05 11:52:21
Alexander Grund wrote:
> If the hash-algorithms would accept `span<const void>` (or <const char>)
> instead as the only `update` method (no need for overloads) we could have
>
> hash_append( span{v} );
> hash_append( span{st} );
>
> by accepting a templated span and casting it to the span-type expected by the
> hash-algorithms.
> And/or a `hash2::span` that accepts any range-like in the ctor and doing the
> cast.
Yes, obviously.
However, there's an additional concern here that people perhaps don't
appreciate. The hash algorithm requirements govern user-defined algorithms
as well. N3980 wasn't supposed to be a library of hash algorithms; it was
supposed to be a framework into which any user-defined hash algorithm
can plug into, and be used for hashing C++ objects.
That's why the hash algorithm interface is kept minimal and uncomplicated
(which is at odds with making it as ergonomic as possible.)
I can obviously support any form of `update` by making it templated and do
the appropriate enable_if incantations, but I don't want to impose this
requirement on hash algorithm authors.
And I don't want to force hash algorithm authors to have to include
<boost/hash2/span.hpp>, because this would mean a physical dependency
on Hash2. At the moment, you can define a hash algorithm without including
anything from Hash2, or anything from Boost. And that's how it has to be.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk