|
Boost : |
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2024-12-05 22:08:23
On 12/6/24 00:59, Ivan Matek wrote:
>
>
> On Thu, Dec 5, 2024 at 10:53â¯PM Andrey Semashev via Boost
> <boost_at_[hidden] <mailto:boost_at_[hidden]>> wrote:
>
> Technically, it doesn't need to be size to separate the two fields. You
> can use any kind of separator, including a fixed one (i.e. not depending
> on either of the fields it separates). I.e. instead of this:
>
> Â "ab" | 2 | "c" | 1
>
> you could have this:
>
> Â "ab" | separator_t{} | "c" | separator_t{}
>
> An empty sequence could simply be hashed as separator_t{}.
>
> The question is how separator_t would hash and whether it could be made
> any faster than just hashing the size. I suppose, it could be smaller
> (e.g. 1 byte of data instead of sizeof(size_t)), but I'm not sure if
> that would mean anything in terms of performance.
>
> As far as I understand that will not work. Assume separator is char 'x'Â
> although it does not really matter what the value is, it is just for
> ease of writing.Â
>
> nowÂ
> "a" | "xc"
> hashes sameÂ
> asÂ
> "ax" | "c"
> because both produce axxc
Yes, you're right.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk