Subject: Re: [boost] [Tokenmap] A (perfect) hash container library chcked-in to sandbox (RFC)
From: Daniel James (daniel_james_at_[hidden])
Date: 2010-02-23 09:03:08


On 23 February 2010 13:38, Andrey Semashev <andrey.semashev_at_[hidden]> wrote:
> On 02/23/2010 03:07 PM, Daniel James wrote:
>>
>> I don't think you could do that without special support from the
>> container.
>
> Why?

The token generation is tied to the data structure, so that a
generated tokens will hash to a free location and, if the container
resizes, all the tokens will still hash to unique locations.

> Session information in the suggested use case may not be suitable for
> storing in a regular container (say, for the lack of copyability).

There's going to be a pointer based container.

> Also, I
> might want different access types to the collection of sessions, token-based
> lookup being one of them.

An ownership policy would allow this.

> Boost.Intrusive is very efficient in cases like
> these, and allowing to use tokens in intrusive hash containers makes perfect
> sense to me.

Intrusive hash containers have slower lookup and require more memory
since they have to deal with collisions.

Daniel