
On 23 February 2010 13:38, Andrey Semashev <andrey.semashev@gmail.com> 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