Subject: Re: [boost] [tokenmap] updated perfect hash container in sandbox
From: strasser_at_[hidden]
Date: 2010-04-21 13:06:37


Zitat von Slawomir Lisznianski <sl_at_[hidden]>:

> http://svn.boost.org/svn/boost/sandbox/tokenmap/libs/tokenmap/doc/html/tokenmap/rationale_.html

I have read the rationale (i.e. example use cases), that's why I was
asking for additional rationale.
I think I have figured it out from the source code now, but I meant
something like:

what is the purpose of the container?
that it can tell valid keys from invalid keys. (-> index into vector)
that keys can not be guessed. (-> randomized key part)
that it can be iterated in linear time to size() instead of
capacity().(-> linked list of nodes)

why is the mapped_type stored by pointer to allocated object instead
of by value?

"One immediate consequence of using this simple strategy is that a
user cannot provide her own tokens"

I think the "randomized part" could be provided by the user, if the
key is a std::pair<index_part, user_part>.

btw, a similar technique (but without the iterating and the
randomizing part) is employed in my implementation of
thread_specific_ptr:
http://www.boostpro.com/vault/index.php?action=downloadfile&filename=tss.hpp&directory=&

that would be another use case of your container if it is configurable
enough in the final version.

Regards,